-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.builder
More file actions
32 lines (20 loc) · 821 Bytes
/
Dockerfile.builder
File metadata and controls
32 lines (20 loc) · 821 Bytes
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
FROM registry.il2.dso.mil/platform-one/devops/pipeline-templates/base-image/harden-nodejs14:14.16.0 AS builder
ARG IS_LOCAL
WORKDIR /app
# temporary fix until P1 adds chown capabilities or makes /home/node owned by appuser
USER root
RUN node -e "const fs = require('fs'); fs.chown('/home/node/', 950, 950, (error) => {console.log(error)});"
USER 950
# COPY
COPY --chown=950:950 . .
# install dependencies
RUN npm i
RUN echo $IS_LOCAL
# if IS_LOCAL use localhost api url
RUN if [ "${IS_LOCAL}" = "true" ]; then npm run build; else GENERATE_SOURCEMAP=false npm run build ; fi
# Stage 2
FROM registry.il2.dso.mil/platform-one/devops/pipeline-templates/base-image/harden-nginx-19:1.19.2
USER appuser
COPY --from=builder --chown=appuser:appuser /app/build /var/www
EXPOSE 8080
CMD [ "nginx", "-g", "daemon off;" ]