Files
stack/infra/images/docs.Dockerfile
kert 8e1d79a983
Some checks failed
CI / lint (push) Successful in 45s
Deploy / notebooks (push) Has been skipped
Deploy / zotero (push) Has been skipped
Deploy / docs (push) Successful in 1m56s
Deploy / api (push) Has been skipped
Deploy / mc (push) Has been skipped
Infra CI / notebooks (push) Failing after 20s
Infra CI / zotero (push) Successful in 18s
Infra CI / docs (push) Successful in 14s
Infra CI / api (push) Successful in 15s
Infra CI / mc (push) Successful in 16s
Deploy / report (push) Successful in 37s
CI / test (push) Has been cancelled
fix(docs): use pre-generated library.json — bib.sqlite corrupts during Docker COPY
2026-04-18 22:35:27 -04:00

58 lines
1.7 KiB
Docker

# Stage 1: Extract docs from Python source + export bib library
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-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:22-slim AS build
RUN corepack enable && corepack prepare pnpm@10.12.1 --activate
WORKDIR /docs
# Install dependencies (pnpm for deterministic, fast installs)
COPY docs/package.json docs/pnpm-lock.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