-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
52 lines (34 loc) · 1.25 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
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}
ARG NODE_OPTIONS=--max-old-space-size=8192
COPY package.json package-lock.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
ARG BUILD_CIPIPELINEID
ENV Build__CiPipelineId=${BUILD_CIPIPELINEID}
ARG BUILD_CICOMMITSHA
ENV Build__CiCommitSha=${BUILD_CICOMMITSHA}
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 npx ng build --configuration=$ANGULAR_ENVIRONMENT
FROM nginx: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/colid-editor-frontend .
EXPOSE 8080