-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.prod
50 lines (32 loc) · 1.04 KB
/
Dockerfile.prod
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Staged build
#
# Command to build for prod:
# docker build -t react-prod -f Dockerfile.prod .
# docker stop react-prod && docker rm react-prod
# docker run --name react-prod -dp 443:443 react-prod
#
# Stage 1 Client
FROM node:14.15.4-alpine as client
WORKDIR /app
COPY ./client/package*.json /app/
ENV PATH /app/node_modules/.bin:$PATH
RUN npm install
COPY ./client /app/
COPY ./doc/config/api_config_prod.json /app/src/config.json
RUN npm run build
# Stage 2 Admin
FROM node:14.15.4-alpine as admin
WORKDIR /app
COPY ./admin/package*.json /app/
ENV PATH /app/node_modules/.bin:$PATH
RUN npm install
COPY ./admin /app/
COPY ./doc/config/api_config_prod.json /app/src
RUN npm run build
# Stage 3, based on Nginx, to have only the compiled app, ready for production with Nginx
FROM nginx:1.15
COPY --from=client /app/build/ /usr/share/nginx/html/client/build
COPY --from=admin /app/build/ /usr/share/nginx/html/admin/build
# Copy the default nginx.conf provided
COPY ./doc/config/dvp_docker.conf /etc/nginx/conf.d/default.conf
COPY ./nginx /app/nginx