Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit cf99c2f

Browse files
committed
build docker for jpproject.net demo site
1 parent c45b982 commit cf99c2f

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# base image
2+
FROM node:12.7-alpine as builder
3+
4+
# install and cache app dependencies
5+
COPY ["src/Frontend/Jp.AdminUI/package.json", "./"]
6+
COPY ["src/Frontend/Jp.AdminUI/package-lock.json", "./"]
7+
8+
## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
9+
10+
RUN npm ci && mkdir /app && mv ./node_modules ./app/
11+
12+
WORKDIR /app
13+
# add app
14+
COPY ["src/Frontend/Jp.AdminUI/", "/app"]
15+
# rebuild node
16+
RUN npm rebuild node-sass
17+
# generate build
18+
RUN npm run ng build -- --configuration=production
19+
20+
##################
21+
### production ###
22+
##################
23+
24+
# base image
25+
FROM nginx:alpine
26+
27+
## Remove default nginx website
28+
RUN rm -rf /usr/share/nginx/html/*
29+
30+
# copy artifact build from the 'build environment'
31+
COPY --from=builder /app/nginx/nginx.conf /etc/nginx/conf.d/default.conf
32+
COPY --from=builder /app/dist /usr/share/nginx/html
33+
34+
# expose port 80
35+
EXPOSE 80/tcp
36+
37+
# run nginx
38+
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)