diff --git a/Dockerfile.nginx.prod b/Dockerfile.nginx.prod new file mode 100644 index 0000000..9e82edb --- /dev/null +++ b/Dockerfile.nginx.prod @@ -0,0 +1,36 @@ +FROM node:18.7.0-alpine3.15 as build + +WORKDIR /app + +RUN addgroup app && \ + adduser -S -G app app + +COPY ["package.json", "yarn.lock", "./"] + +RUN yarn + +COPY . . + +RUN yarn build + +# 2nd stage +FROM nginx:1.23.3-alpine-slim + +USER root + +RUN rm /etc/nginx/conf.d/default.conf && \ + rm /etc/nginx/nginx.conf && \ + chown -R nginx:nginx /var/cache/nginx && \ + chown -R nginx:nginx /var/run && \ + touch /var/run/nginx.pid && \ + chown -R nginx:nginx /var/run/nginx.pid + +COPY --from=build /app/dist /usr/share/nginx/html +COPY .nginx/nginx.conf /etc/nginx/nginx.conf +COPY .nginx/conf.d /etc/nginx/conf.d + +USER nginx + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file