forked from Fechin/reference
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
24 lines (22 loc) · 719 Bytes
/
Dockerfile
File metadata and controls
24 lines (22 loc) · 719 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
# Stage 1: build the application
FROM node:19 AS build-app
WORKDIR /app
COPY . .
RUN npm install -g pnpm
RUN pnpm install
RUN pnpm run build
# Stage 2: Build nginx
FROM nginx:alpine AS build-nginx
WORKDIR /usr/share/nginx/html/
COPY --from=build-app /app/public /usr/share/nginx/html/
RUN rm -rf /etc/nginx/conf.d/*
COPY nginx.conf /etc/nginx/
EXPOSE 80
# Stage 3: final image
FROM alpine:latest
RUN apk add --no-cache nginx && mkdir -p /run/nginx
COPY --from=build-nginx /usr/share/nginx/html/ /usr/share/nginx/html/
COPY --from=build-nginx /etc/nginx/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
HEALTHCHECK --interval=1s --timeout=3s CMD wget -q -O - http://localhost:80 || exit 1
CMD ["nginx", "-g", "daemon off;"]