nginx
This commit is contained in:
@ -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;"]
|
||||
|
||||
@ -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" ]
|
||||
Reference in New Issue
Block a user