mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-13 06:06:38 +00:00
Every role README carries a ```mermaid flowchart and the documentation showed it as source. A post-transform now replaces those literal blocks with <pre class="mermaid"> in html builds, which the runtime picks up; every other builder keeps the fence as it was. sphinxcontrib-mermaid injects an inline init script, which this deployment's CSP refuses, so the runtime and its initialisation are two linked files instead: mermaid-init.js calls mermaid.initialize with securityLevel strict and follows the reader's colour scheme. The diagram source is html-escaped before it is embedded, or an & or < in a node label would break the page. The runtime is fetched at image build time through ADD --checksum, so a changed upstream file fails the build rather than shipping. Version and digest are not ARG defaults, which test_arg_without_default forbids; they travel meta/services.yml -> vars/main.yml -> compose.yml.j2 the way DOCS_IMAGE and DOCS_VERSION already do, and an update block registers the pin with the npm version watcher instead of exempting it. Verified by building a page with sphinx: the diagram arrives as <pre class="mermaid"> with its source escaped, a bash fence stays a highlighted block, and both scripts are linked. A missing mermaid.min.js does not fail that build, so a local run without the image stays green. scripts/lint/mermaid.sh keeps validating diagram syntax through mmdc, which npm installs unpinned. It therefore checks against a newer mermaid than the 11.4.1 readers get, and a diagram using syntax from in between would pass the lint and render blank. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
37 lines
886 B
Docker
37 lines
886 B
Docker
ARG DOCS_IMAGE
|
|
ARG DOCS_VERSION
|
|
|
|
FROM ${DOCS_IMAGE}:${DOCS_VERSION}
|
|
|
|
ARG DOCS_SOURCE_REPO
|
|
|
|
RUN rm -rf /var/lib/apt/lists/* \
|
|
&& apt-get -o Acquire::Retries=3 update \
|
|
&& apt-get -o Acquire::Retries=3 install -y --no-install-recommends git pandoc \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN pip install --no-cache-dir \
|
|
myst-parser \
|
|
pathspec \
|
|
pyyaml \
|
|
sphinx \
|
|
sphinxawesome-theme \
|
|
"infinito-nexus[deploy] @ git+${DOCS_SOURCE_REPO}"
|
|
|
|
COPY ./sphinx/python/ /app/
|
|
COPY ./sphinx/javascript/ /app/infinito_docs/assets/js/
|
|
|
|
ARG MERMAID_VERSION
|
|
ARG MERMAID_SHA256
|
|
ADD --chmod=0644 --checksum=sha256:${MERMAID_SHA256} \
|
|
https://cdn.jsdelivr.net/npm/mermaid@${MERMAID_VERSION}/dist/mermaid.min.js \
|
|
/app/infinito_docs/assets/js/mermaid.min.js
|
|
ADD ./sphinx/snapshot.tar.gz /snapshot/
|
|
|
|
ENV PYTHONPATH=/app
|
|
WORKDIR /app
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["python", "-m", "infinito_docs.server"]
|