Created
March 13, 2023 14:46
-
-
Save devenes/8eaefac3ba729dd6f8962a7e2a6f2a4c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use a multi-stage build to optimize image size | |
FROM node:14-alpine AS build | |
WORKDIR /app | |
COPY package*.json ./ | |
RUN npm ci --only=production | |
COPY . . | |
RUN npm run build | |
FROM nginx:alpine | |
LABEL maintainer="Your Name <[email protected]>" | |
# Install necessary packages | |
RUN apk add --no-cache --update \ | |
curl \ | |
openssl \ | |
supervisor | |
# Copy files from build stage | |
COPY --from=build /app/dist /usr/share/nginx/html | |
COPY nginx.conf /etc/nginx/nginx.conf | |
COPY default.conf /etc/nginx/conf.d/default.conf | |
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf | |
# Set up SSL certificate | |
RUN mkdir -p /etc/nginx/ssl | |
RUN openssl req -x509 -newkey rsa:4096 -keyout /etc/nginx/ssl/nginx.key \ | |
-out /etc/nginx/ssl/nginx.crt -days 365 -nodes -subj "/CN=localhost" | |
# Start supervisor to run multiple processes | |
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment