forked from cmu-sei/Vm.Ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
34 lines (23 loc) · 856 Bytes
/
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
FROM node:20-alpine as builder
COPY package.json package-lock.json ./
# Storing node modules on a separate layer will prevent unnecessary npm install at each build
RUN npm set progress=false && \
npm config set depth 0 && \
npm cache clean --force
RUN npm ci && mkdir -p /ng-app/dist && cp -R ./node_modules ./ng-app
WORKDIR /ng-app
COPY . .
RUN npx ng build
### Stage 2: Setup ###
FROM nginxinc/nginx-unprivileged:stable-alpine
USER root
RUN rm -rf /usr/share/nginx/html/*
COPY default.conf /etc/nginx/conf.d/default.conf
COPY nginx-basehref.sh /docker-entrypoint.d/90-basehref.sh
COPY --from=builder /ng-app/dist/browser /usr/share/nginx/html
RUN chown -R nginx:nginx /usr/share/nginx/html && \
chmod +x /docker-entrypoint.d/90-basehref.sh
USER nginx
EXPOSE 8080
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]