-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
31 lines (22 loc) · 895 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
# STEP 1 building your app
FROM node:20-alpine as builder
RUN apk update && apk add --no-cache make git
# a) Create app directory
WORKDIR /app
# b) Install app dependencies
COPY package.json package-lock.json /app/
RUN cd /app && npm set progress=false && npm install -f
# c) Copy project files into the docker image and build your app
COPY . /app
RUN cd /app && npm run ng build --prod --output-path=dist
# STEP 2 build a small nginx image
FROM nginx:1.22.1-alpine
# a) Remove default nginx code
RUN rm -rf /usr/share/nginx/html/*
# b) From 'builder' copy your site to default nginx public folder
COPY --from=builder /app/dist /usr/share/nginx/html
# c) copy your own default nginx configuration to the conf folder
RUN rm -rf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/nginx/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]