forked from steph-del/veglab-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.prod
61 lines (46 loc) · 1.54 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
50
51
52
53
54
55
56
57
58
59
60
61
#############
### build ###
#############
# base image
FROM node:12.13.0 as build
# install chrome for protractor tests
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
RUN apt-get update && apt-get install -yq google-chrome-stable gettext
# set working directory
WORKDIR /client
# add `/client/node_modules/.bin` to $PATH
ENV PATH /client/node_modules/.bin:$PATH
# install and cache app dependencies
COPY package.json /client/package.json
RUN npm install
RUN npm install -g @angular/cli@7.3.9
# get env var
ARG HOST
ARG API_PORT
ARG ES_PORT
ARG SSO_PORT
ARG ELASTIC_PASSWORD
ARG ES_REPO_PASSWORD
# add app
COPY . /client
# add environments vars and bind HOST
RUN envsubst < ./src/environments/environment.prod.ts > /client/src/environments/environment.prod.ts.tmp && mv /client/src/environments/environment.prod.ts.tmp /client/src/environments/environment.prod.ts
# run tests
#RUN ng test --watch=false
#RUN ng e2e --port 4202
# generate build
RUN node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build --prod --output-path=dist
#RUN set NODE_OPTIONS=--max-old-space-size=14336 && \
# ng build --prod --output-path=dist
############
### prod ###
############
# base image
FROM nginx:1.16.0-alpine
# copy artifact build from the 'build environment'
COPY --from=build /client/dist /usr/share/nginx/html
# expose port 80
EXPOSE 80
# run nginx
CMD ["nginx", "-g", "daemon off;"]