-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDockerfile
57 lines (39 loc) · 1.41 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
# base stage installs the project dependencies
FROM node:19-alpine3.16 as base
# install non-npm build dependencies
RUN apk add --no-cache \
# required by degit (dep/legumeinfo-microservices)
git \
# required by grpc-tools (dep/legumeinfo-microservices)
libc6-compat
WORKDIR /gcv
# prepare to install npm dependencies
COPY package.json .
COPY package-lock.json .
COPY scripts/ ./scripts
COPY dep/ ./dep
# install npm build dependencies
# enable legacy SSL support: https://medium.com/the-node-js-collection/node-js-17-is-here-8dba1e14e382#5f07
ENV NODE_OPTIONS=--openssl-legacy-provider
RUN npm ci
# copy the project
COPY . .
# dev stage runs the dev server
FROM base as dev
ENTRYPOINT ["npx", "ng", "serve", "--host", "0.0.0.0"]
EXPOSE 4200
# build stage builds the project for production
FROM base as build
# allow people building manually to pass arguments to angular
ARG ANGULAR_BUILD_OPTIONS=''
# build the project
RUN npx ng build --configuration production $ANGULAR_BUILD_OPTIONS
# prod stage deploys the project with NGINX
FROM nginx:1.23-alpine as prod
# copy the nginx configuration template
COPY nginx/templates/default.conf.template /etc/nginx/templates/
# set the default values for the variables used in the template
ENV GCV_PATH=/gcv
# put the build artifacts where nginx can find them
COPY --from=build /gcv/dist /usr/share/nginx/html
# the nginx image automatically runs nginx and exposes port 80