-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (28 loc) · 886 Bytes
/
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
### STAGE 1: Build ###
FROM node:16-alpine AS deps
### Change workdir
WORKDIR /usr/src/app
### Install packages
COPY package.json package-lock.json ./
RUN npm ci
### Copy source code
COPY . .
# Dev environment build
FROM deps as dev
CMD ["npm", "start"]
# Prod environment build
FROM deps as build
### Change workdir
WORKDIR /usr/src/app
## Build the angular app in production mode and store the artifacts in dist folder
RUN $(npm bin)/ng build --configuration production
### STAGE 2: Run ###
FROM nginx:1.17.1-alpine
## Copy our default nginx config
COPY nginx/default.conf /etc/nginx/default.conf
## Remove default nginx website
RUN rm -rf /usr/share/nginx/html/*
## From ‘build’ stage copy over the artifacts in dist folder to default nginx public folder
COPY --from=build /usr/src/app/dist/platform /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]