-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
31 lines (26 loc) · 912 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
### STAGE 1: Build ###
FROM node:16 as build
RUN mkdir -p /home/app/react
WORKDIR /home/app/react
ENV PATH /home/app/react/node_modules/.bin:$PATH
COPY package.json /home/app/react/package.json
RUN npm cache clean --force
RUN npm config rm proxy
RUN npm config rm https-proxy
RUN npm cache verify
RUN npm config delete proxy
RUN npm config delete http-proxy
RUN npm config delete https-proxy
RUN npm cache clean --force && npm set timeout=100000 && npm install --legacy-peer-deps
RUN npm install react-scripts -g --legacy-peer-deps
COPY . /home/app/react
# chown all the files to the app user
RUN addgroup --system nginx && adduser --system --group nginx
RUN chown -R nginx:nginx /home/app/react
USER nginx
RUN npm run build
### STAGE 2: Production Environment ###
# FROM nginx:1.13.12-alpine
# COPY --from=build /home/app/react/build /usr/share/nginx/html
# EXPOSE 80
# CMD ["nginx", "-g", "daemon off;"]