-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
56 lines (41 loc) · 1.16 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
#############
### build ###
#############
# base image
FROM node:12.10.0 as build
# install chrome for protractor tests
RUN apt-get update && apt-get install
# set working directory
WORKDIR /app
# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
# install and cache app dependencies
COPY ./clients/html/package.json /app/package.json
COPY ./clients/html/package-lock.json /app/package-lock.json
RUN npm ci
# add app
COPY ./clients/html/ /app
# run tests
#RUN ng test --watch=false
#RUN ng e2e --port 4202
ARG API_URL
RUN sed -i -r "s/API_URL/$API_URL/g" /app/src/environments/environment.prod.ts
# generate build
# CLIENT value is lowercase client shortname - me, dc
ARG CLIENT
RUN npm run "build:prod:$CLIENT"
############
### prod ###
############
# base image
FROM nginx:1.16.0-alpine
# copy artifact build from the 'build environment'
COPY --from=build /app/dist /usr/share/nginx/html
# copy nginx configuration
ARG API_URL
COPY ./.docker/production/web/nginx.conf /etc/nginx/conf.d/$API_URL.conf
RUN sed -i -r "s/API_URL/$API_URL/g" /etc/nginx/conf.d/$API_URL.conf
# expose port 80
#EXPOSE 80
# run nginx
#CMD ["nginx", "-g", "daemon off;"]