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

View File

@ -1,13 +1,17 @@
FROM node:20-alpine
ENV CI=true
ENV PORT=3000
ENV HOST=0.0.0.0
ENV WDS_SOCKET_PORT=0
# stage1 - build react app first
FROM node:20-alpine as build
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY ./app/package.json /app/
COPY ./app/yarn.lock /app/
RUN yarn
COPY /app /app
RUN yarn build
RUN npm ci
CMD [ "npm", "start" ]
# 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/nginx.conf /etc/nginx/conf.d
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@ -1,14 +0,0 @@
FROM node:20-alpine
ENV PORT=3000
ENV HOST=0.0.0.0
ENV WDS_SOCKET_PORT=0
WORKDIR /app
COPY /app /app
RUN npm ci
RUN npm run build
CMD [ "npm", "start" ]