-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.docs
More file actions
37 lines (29 loc) · 1.43 KB
/
Copy pathDockerfile.docs
File metadata and controls
37 lines (29 loc) · 1.43 KB
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
# ── Stage 1: build the Vite docs app ─────────────────────────────────────────
FROM node:22-alpine AS builder
WORKDIR /repo
# The docs package has a local dependency on the root npm wrapper. Copy only
# that published wrapper plus locked documentation dependencies before source.
COPY package.json index.js install.js README.md LICENSE ./
COPY docs/package.json docs/package-lock.json ./docs/
# Install docs deps without executing package lifecycle scripts. The production
# image serves static files only and deliberately contains no compiler binary.
WORKDIR /repo/docs
RUN npm ci --ignore-scripts
COPY docs/ ./
RUN npm run build
# ── Stage 2: static-only production runtime ──────────────────────────────────
FROM node:22-alpine AS runtime
ARG ZIGCSS_VERSION=0.6.0-rc.2
LABEL org.opencontainers.image.title="ZigCSS Documentation" \
org.opencontainers.image.version="${ZIGCSS_VERSION}" \
org.opencontainers.image.source="https://github.com/vyakymenko/zigcss"
WORKDIR /app
# Copy only the files needed by the static server. They remain root-owned and
# read-only to the unprivileged runtime account.
COPY --from=builder /repo/docs/dist ./dist
COPY --from=builder /repo/docs/server.js ./server.js
ENV NODE_ENV=production
ENV PORT=8080
EXPOSE 8080
USER node
CMD ["node", "server.js"]