-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
41 lines (26 loc) · 886 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
35
36
37
38
39
FROM node:lts-alpine as builder
# Enable and configure pnpm
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
COPY . /app
# -------------- Project build Stage -----------------
# Install dependencies and enable cache
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
# Build app
RUN pnpm run build
# ------------------ NGINX Stage --------------------
FROM nginx:alpine as runtime
# Remove default nginx static assets
RUN rm -rf /usr/share/nginx/html
# Copy built site
COPY --from=builder /app/dist /usr/share/nginx/html
# Remove default nginx config
RUN rm /etc/nginx/conf.d/default.conf
# Copy custom nginx config
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
# Expose default Nginx port
EXPOSE 80
# Start Nginx with global directives and daemon turned off
ENTRYPOINT [ "nginx", "-g", "daemon off;" ]