fix(docs): use pre-generated library.json — bib.sqlite corrupts during Docker COPY
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

This commit is contained in:
kert
2026-04-18 22:35:27 -04:00
parent 472f2aa66a
commit 8e1d79a983

View File

@@ -10,14 +10,12 @@ COPY docs/scripts/ docs/scripts/
# Extract API docs via griffe (pure AST, no imports) # Extract API docs via griffe (pure AST, no imports)
RUN uv run --with griffe python docs/scripts/extract_docs.py RUN uv run --with griffe python docs/scripts/extract_docs.py
# Export bibliography. The COPY uses a multi-source form so the # Bibliography: library.json is pre-generated on the host via
# bib.sqlite is optional — `data/.gitkeep` guarantees there's always # uv run --with pydantic python docs/scripts/export_library.py
# at least one matching source so BuildKit doesn't error on an empty # and lives in docs/static/library.json (gitignored, 193MB).
# glob like `data/bib.sqlit[e]` did. The export script in turn # It's included in the build via COPY docs/static/ in stage 2.
# tolerates a missing bib.sqlite and writes an empty library.json. # We don't regenerate inside Docker because bib.sqlite is 234MB,
RUN mkdir -p data # may be locked by the backfill, and corrupts on concurrent read.
COPY data/.gitkeep data/bib.sqlit[e] data/
RUN uv run --with pydantic python docs/scripts/export_library.py || (mkdir -p docs/static && echo '{"items":[]}' > docs/static/library.json)
# Stage 2: Build Docusaurus static site # Stage 2: Build Docusaurus static site
@@ -37,10 +35,9 @@ COPY docs/src/ src/
COPY docs/static/ static/ COPY docs/static/ static/
COPY docs/docs/ docs/ COPY docs/docs/ docs/
# Copy generated API docs and library.json from extract stage # Copy generated API docs from extract stage
COPY --from=extract /build/docs/docs/api/ docs/api/ COPY --from=extract /build/docs/docs/api/ docs/api/
COPY docs/docs/api/index.md docs/api/index.md COPY docs/docs/api/index.md docs/api/index.md
COPY --from=extract /build/docs/static/library.json static/library.json
RUN pnpm build RUN pnpm build