Repository navigation
Expand file tree
/
Copy pathDockerfile.docs
More file actions
42 lines (33 loc) · 2.18 KB
/
Copy pathDockerfile.docs
File metadata and controls
42 lines (33 loc) · 2.18 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
38
39
40
41
42
# syntax=docker/dockerfile:1.7@sha256:a57df69d0ea827fb7266491f2813635de6f17269be881f696fbfdf2d83dda33e
# ── Stage 1: build the Vite docs app ─────────────────────────────────────────
FROM node:24.20.0-alpine@sha256:e67514e5d0f6c46656005e1b693b2ec9d52e80b641307de684d4a015ba7a4eaf AS builder
WORKDIR /repo
# The docs package has a local dependency on the root npm package. Copy its
# complete published runtime, declaration, and trust closure before source.
COPY package.json index.js install.js api.cjs api.mjs api.d.cts api.d.mts api.d.ts native-integrity.json PREPROCESSOR-SBOM.spdx.json THIRD_PARTY_NOTICES.md README.md LICENSE ./
COPY adapters/ ./adapters/
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
RUN node -e 'for (const id of ["zigcss", "zigcss/adapters", "zigcss/vite", "zigcss/rollup", "zigcss/esbuild", "zigcss/bun", "zigcss/webpack", "zigcss/rspack"]) require(id)' && \
node --input-type=module -e 'for (const id of ["zigcss", "zigcss/adapters", "zigcss/vite", "zigcss/rollup", "zigcss/esbuild", "zigcss/bun", "zigcss/webpack", "zigcss/rspack"]) await import(id)'
COPY docs/ ./
RUN npm run build
# ── Stage 2: static-only production runtime ──────────────────────────────────
FROM node:24.20.0-alpine@sha256:e67514e5d0f6c46656005e1b693b2ec9d52e80b641307de684d4a015ba7a4eaf AS runtime
ARG ZIGCSS_VERSION=0.7.0-rc.4
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"]