-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
53 lines (35 loc) · 1.27 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
FROM node:20.16.0-alpine AS base
ENV APP_DIR=/app
RUN mkdir -p ${APP_DIR}
WORKDIR ${APP_DIR}
# Install dependencies only when needed
FROM base AS deps
ENV CI=1
ENV HUSKY=0
# Install dependencies based on the preferred package manager
COPY package.json pnpm-lock.yaml* ./
COPY patches ./patches
RUN corepack enable pnpm
RUN pnpm config set store-dir ~/.pnpm-store
# First install the dependencies (as they change less often)
RUN --mount=type=cache,id=pnpm,target=~/.pnpm-store pnpm install --frozen-lockfile
# Rebuild the source code only when needed
FROM base AS builder
# Define all origins that are allowed to frame this website
ARG ALLOWED_FRAME_ANCESTORS
ENV VITE_ALLOWED_FRAME_ANCESTORS=${ALLOWED_FRAME_ANCESTORS}
ENV CI=1
ARG VITE_DEBUG
ENV VITE_DEBUG=${VITE_DEBUG}
COPY --from=deps ${APP_DIR}/node_modules ./node_modules
COPY . .
RUN corepack enable pnpm && pnpm run build
FROM nginx:stable-alpine AS runner
ARG ALLOWED_FRAME_ANCESTORS
ENV ALLOWED_FRAME_ANCESTORS=${ALLOWED_FRAME_ANCESTORS}
COPY --from=builder /app/nginx/nginx.conf /etc/nginx/
COPY --from=builder /app/nginx/mime.types /etc/nginx/
COPY --from=builder /app/nginx/default.conf.template /etc/nginx/templates/
COPY --from=builder /app/dist /usr/share/nginx/html
RUN chmod -R a+wx /etc/nginx/conf.d
EXPOSE 8080