This commit is contained in:
2023-05-27 00:38:58 +03:00
parent 2f1f7d072c
commit 47bda44d45
6 changed files with 72 additions and 36 deletions

17
Dockerfile.react-prod Normal file
View File

@ -0,0 +1,17 @@
# stage1 - build react app first
FROM node:20-alpine as build
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY react/app/package.json .
COPY react/app/package-lock.json .
RUN npm ci
COPY react/app .
RUN npm run build
# stage 2 - build the final image and copy the react build files
FROM nginx:1.25.0-alpine
COPY --from=build /app/build /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx-prod.conf /etc/nginx/conf.d
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]