new snippet

This commit is contained in:
2023-05-27 02:25:02 +03:00
parent 0053f57d52
commit 0932458d41
9 changed files with 164 additions and 44 deletions

View File

@ -1,17 +1,21 @@
# 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
FROM node:20.1
# 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;"]
ENV CI=true
ENV PORT=3000
ENV HOST=0.0.0.0
ENV WDS_SOCKET_PORT=0
ENV REACT_APP_DOMAIN=127.0.0.1
WORKDIR /app
COPY /app /app
# COPY package.json /app/package.json
# COPY package-lock.json /app/package-lock.json
# Same as npm install
RUN npm ci
# COPY . /app
#
RUN printenv
CMD [ "npm", "start" ]