Browse Source

docker production build

pull/2/head
Muhammad Sulaiman Yusuf 2 years ago
parent
commit
39d81ee150
  1. 29
      Dockerfile

29
Dockerfile

@ -1,20 +1,19 @@
FROM node:12 CMD PORT=8445 npm start #--host 0.0.0.0 --port 3000 --disableHostCheck true
WORKDIR /react-docker
COPY ./package*.json ./ FROM node:14.20-alpine3.15
ENV PATH /app/node_modules/.bin:$PATH
WORKDIR /app
COPY package*.json ./
RUN npm install RUN npm install
RUN npm i react@16.14.0
RUN npm i react-scripts
RUN npm audit fix
EXPOSE 8445 COPY . .
# Comment as needed (Production / Dev) RUN npm run build --production
# [PROD] Use for Production
# COPY . . # uncomment prod
# [DEV] Live Reload RUN npm install -g serve
RUN mkdir -p /react-docker/src # comment for prod
RUN mkdir -p /react-docker/public # comment for prod
CMD PORT=8445 npm start #--host 0.0.0.0 --port 3000 --disableHostCheck true EXPOSE 8445
CMD serve -p 8455 -s build

Loading…
Cancel
Save