-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (24 loc) · 1.05 KB
/
Dockerfile
File metadata and controls
40 lines (24 loc) · 1.05 KB
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
### STAGE 1: Build ###
# We label our stage as ‘builder’
FROM node:10-alpine as builder
COPY ./DevActivator/package.json ./DevActivator/npm-shrinkwrap.json ./
## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
RUN npm ci && mkdir /ng-app && mv ./node_modules ./ng-app
WORKDIR /ng-app
COPY DevActivator .
## Run tslint
RUN npm run lint
## Build the angular app in production mode and store the artifacts in dist folder
RUN npm run prod
### STAGE 2: Setup ###
FROM nginx:alpine
# COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/default.conf /etc/nginx/conf.d/
RUN rm -rf /usr/share/nginx/html/*
# ## From ‘builder’ stage copy over the artifacts in dist folder to default nginx public folder
COPY ./DevActivator/wwwroot /usr/share/nginx/html
COPY ./nginx/index.html /usr/share/nginx/html
COPY --from=builder /ng-app/wwwroot/dist /usr/share/nginx/html
CMD ["nginx", "-g", "daemon off;"]
# * docker image build -t dotnetru/devactivator:latest .
# * docker run -p 3000:80 --rm dotnetru/devactivator:latest