Files
stack/infra/images/docs.Dockerfile
kert cf292ca7c5 chore(deps): Node 22 → 26 for the docs and notebooks builds
Node 26 is the current LTS. It ships without corepack (dropped from
Node 25 on), so both build stages died at `corepack enable` ("not
found"). Each now installs a pinned corepack from npm first
(COREPACK_VERSION=0.36.0, renovate-annotated so it gets bumped too).

Verified: both images build on node 26; the notebooks image passes
nb_fe_smoke --image (marimo home and editor, no console errors); the
docs site renders /, /api/ and search with no page errors.
2026-10-29 19:30:33 -04:00

64 lines
2.0 KiB
Docker

# Stage 1: Extract docs from Python source + export bib library
FROM ghcr.io/astral-sh/uv:0.13.2-python3.13-trixie-slim AS extract
WORKDIR /build
# Copy source code and extraction scripts
COPY src/ src/
COPY docs/scripts/ docs/scripts/
# Extract API docs via griffe (pure AST, no imports)
RUN uv run --with griffe python docs/scripts/extract_docs.py
# Bibliography: library.json is pre-generated on the host via
# uv run --with pydantic python docs/scripts/export_library.py
# and lives in docs/static/library.json (gitignored, 193MB).
# It's included in the build via COPY docs/static/ in stage 2.
# We don't regenerate inside Docker because bib.sqlite is 234MB,
# may be locked by the backfill, and corrupts on concurrent read.
# Stage 2: Build Docusaurus static site
FROM node:26-slim AS build
# No `corepack prepare <version>`: corepack runs the pnpm that
# docs/package.json's packageManager names, so Renovate's bump of that
# field is the whole upgrade (a second pin here went stale at pnpm 12).
# Node 25+ no longer bundles corepack, so install a pinned one from npm.
# renovate: datasource=npm depName=corepack
ARG COREPACK_VERSION=0.36.0
RUN npm install -g corepack@${COREPACK_VERSION} && corepack enable
WORKDIR /docs
# Install dependencies (pnpm for deterministic, fast installs)
COPY docs/package.json docs/pnpm-lock.yaml docs/pnpm-workspace.yaml ./
RUN pnpm install --frozen-lockfile
# Copy Docusaurus config and source
COPY docs/docusaurus.config.js docs/sidebars.js docs/babel.config.js docs/tsconfig.json ./
COPY docs/src/ src/
COPY docs/static/ static/
COPY docs/docs/ docs/
# Copy generated API docs from extract stage
COPY --from=extract /build/docs/docs/api/ docs/api/
COPY docs/docs/api/index.md docs/api/index.md
RUN pnpm build
# Stage 3: Serve with nginx
# hadolint ignore=DL3006
FROM nginx:alpine
RUN apk upgrade --no-cache
COPY --from=build /docs/build /usr/share/nginx/html
COPY docs/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD wget -qO /dev/null http://127.0.0.1:80/ || exit 1