-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
160 lines (113 loc) · 3.12 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# see https://hub.docker.com/_/nginx/
ARG NGINX_VERSION=nginx:1.23.1-alpine
ARG HUB_VERSION=node:16.5.0-alpine3.13
###
# Stage 1 - build client webapp
###
FROM ${HUB_VERSION} as webAppBuilds
ENV PORT 3010
# set working directory
WORKDIR /clientApp
# install app dependencies
COPY ./client-ui/package.json ./
COPY ./client-ui/package-lock.json ./
RUN npm install
# Copy source files
COPY ./client-ui/ .
# install components library dependencies
WORKDIR /clientApp/USupport-components-library
RUN npm install
WORKDIR /clientApp
# Building app
RUN npm run build --prod
# remove dev dependencies
RUN npm prune --production
# EXPOSE 3010
###
# Stage 2 - build provider webapp
###
# set working directory
WORKDIR /providerApp
# install app dependencies
COPY ./provider-ui/package.json ./
COPY ./provider-ui/package-lock.json ./
RUN npm install
# Copy source files
COPY ./provider-ui/ .
# install components library dependencies
WORKDIR /providerApp/USupport-components-library
RUN npm install
WORKDIR /providerApp
# Building app
RUN npm run build --prod
# remove dev dependencies
RUN npm prune --production
###
# Stage 3 - build country admin webapp
###
# set working directory
WORKDIR /countryAdminApp
# install app dependencies
COPY ./admin-country-ui/package.json ./
COPY ./admin-country-ui/package-lock.json ./
RUN npm install
# Copy source files
COPY ./admin-country-ui/ .
# install components library dependencies
WORKDIR /countryAdminApp/USupport-components-library
RUN npm install
WORKDIR /countryAdminApp
# Building app
RUN npm run build --prod
# remove dev dependencies
RUN npm prune --production
###
# Stage 4 - build global admin webapp
###
# set working directory
WORKDIR /globalAdminApp
# install app dependencies
COPY ./admin-global-ui/package.json ./
COPY ./admin-global-ui/package-lock.json ./
RUN npm install
# Copy source files
COPY ./admin-global-ui/ .
# install components library dependencies
WORKDIR /globalAdminApp/USupport-components-library
RUN npm install
WORKDIR /globalAdminApp
# Building app
RUN npm run build --prod
# remove dev dependencies
RUN npm prune --production
###
# Stage 5 - build website
###
# set working directory
WORKDIR /websiteApp
# install app dependencies
COPY ./website/package.json ./
COPY ./website/package-lock.json ./
RUN npm install
# Copy source files
COPY ./website/ .
# install components library dependencies
WORKDIR /websiteApp/USupport-components-library
RUN npm install
WORKDIR /websiteApp
# Building app
RUN npm run build --prod
# remove dev dependencies
RUN npm prune --production
###
# Stage 6 - nginx server
###
FROM ${NGINX_VERSION}
COPY ./webproxy/nginx-production.conf /etc/nginx/nginx.conf
# copy web app builds to nginx/html
COPY --from=webAppBuilds /clientApp/dist /usr/share/nginx/html/client
COPY --from=webAppBuilds /providerApp/dist /usr/share/nginx/html/provider
COPY --from=webAppBuilds /countryAdminApp/dist /usr/share/nginx/html/country-admin
COPY --from=webAppBuilds /globalAdminApp/dist /usr/share/nginx/html/global-admin
COPY --from=webAppBuilds /websiteApp/dist /usr/share/nginx/html/website
EXPOSE 80