forked from brunobritodev/JPProject.IdentityServer4.AdminUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin-ui.dockerfile
41 lines (31 loc) · 1005 Bytes
/
admin-ui.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
# base image
FROM node:13.12-alpine as builder
ARG env=docker
# install and cache app dependencies
COPY ["src/Frontend/Jp.AdminUI/package.json", "./"]
COPY ["src/Frontend/Jp.AdminUI/package-lock.json", "./"]
## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
RUN npm ci && mkdir /app && mv ./node_modules ./app/
WORKDIR /app
# add app
COPY ["src/Frontend/Jp.AdminUI/", "/app"]
# rebuild node
RUN cat src/environments/environment.${env}.ts
# RUN npm rebuild node-sass
# generate build
RUN npm i
RUN npm run ng build -- --configuration=${env}
##################
### production ###
##################
# base image
FROM nginx:alpine
## Remove default nginx website
RUN rm -rf /usr/share/nginx/html/*
# copy artifact build from the 'build environment'
COPY --from=builder /app/nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist /usr/share/nginx/html
# expose port 80
EXPOSE 80/tcp
# run nginx
CMD ["nginx", "-g", "daemon off;"]