-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.unprivileged
48 lines (32 loc) · 1.25 KB
/
Dockerfile.unprivileged
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
FROM node:18-alpine as build-phase
ARG ANGULAR_ENVIRONMENT
ENV ANGULAR_ENVIRONMENT=${ANGULAR_ENVIRONMENT}
ARG BUILD_CIJOBID
ENV Build__CiJobId=${BUILD_CIJOBID}
ARG BUILD_CIPIPELINEID
ENV Build__CiPipelineId=${BUILD_CIPIPELINEID}
ARG BUILD_CICOMMITSHA
ENV Build__CiCommitSha=${BUILD_CICOMMITSHA}
COPY package.json ./
## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
RUN npm install \
&& mkdir /ng-app \
&& cp -R ./node_modules ./ng-app
##3 against vulnerable packages
RUN npm audit fix
WORKDIR /ng-app
COPY . .
RUN echo "export const BUILD = {\
jobId: '$Build__CiJobId',\
pipelineId: '$Build__CiPipelineId',\
ciCommitSha: '$Build__CiCommitSha'\
}" > ./src/assets/build-variables.ts
## Build the angular app and store the artifacts in dist folder
RUN $(npm bin)/ng build --progress=true --configuration=$ANGULAR_ENVIRONMENT --output-hashing=all
#NGINX Docker images that run NGINX as a non root, unprivileged user
FROM nginxinc/nginx-unprivileged:1.17-alpine
WORKDIR /usr/share/nginx/html
#RUN rm -rf /usr/share/nginx/html/* && rm -rf /etc/nginx/conf.d/* && rm -rf /etc/nginx/nginx.conf*
COPY ./nginx.conf /etc/nginx/
COPY --from=build-phase /ng-app/dist/resource-relationship-manager-frontend .
EXPOSE 8080