Skip to content

Deploy the documentation site

Build the documentation as a portable static artifact

Section titled “Build the documentation as a portable static artifact”

The documentation site reads its canonical Markdown directly from docs/, validates the committed Python/Telegram/Rust reference, builds Astro/Starlight, creates a local Pagefind index, runs browser acceptance and then validates the emitted routes and assets. From a clean checkout:

rustup toolchain install nightly
cargo install cargo-docs-md --locked
uv sync --group docs --frozen
pnpm --dir docs-site install --frozen-lockfile
uv run poe docs --check --build --skip-install

The artifact is docs-site/dist/. Deploy or copy that directory as an indivisible output; do not regenerate search separately or combine HTML from one build with assets from another. The deployed site requires no Node.js, Python, Rust, database or search process at runtime.

The default build uses the origin root /. Configure only the canonical origin when building for an origin-root host:

$env:MINIPROTO_DOCS_SITE = "https://miniproto.edm115.dev"
uv run poe docs --check --build --skip-install

For a subpath host, set MINIPROTO_DOCS_BASE to that public prefix, for example /miniproto. For https://edm115.github.io/miniproto/, set the origin to https://edm115.github.io and the base to /miniproto. The custom domain https://miniproto.edm115.dev/ serves the origin root. Serve docs-site/dist/ with any static web server or copy it into the server’s immutable release directory, then point the web root at those bytes. Preserve trailing-slash routing and the generated 404.html; do not proxy Pagefind queries to an application server.

The repository also provides a multi-stage, root-base image. Build and validate the static output first, then package it from the repository root:

Terminal window
MINIPROTO_DOCS_SITE=https://miniproto.edm115.dev MINIPROTO_DOCS_BASE=/ pnpm --dir docs-site build
docker build --file docs-site/Dockerfile --tag miniproto-docs .
docker rm -f miniproto-docs
docker run --detach --name miniproto-docs --publish 6743:6743 miniproto-docs

The default Docker target checks the prepared artifact in alpine:3 and packages it in nginxinc/nginx-unprivileged:stable-alpine. Build Astro before invoking this target so the container build only checks and packages the static output. The runtime listens on port 6743 as UID 101 and includes a local HTTP health check. It contains the static output only: no Python, Rust toolchain, Node.js, pnpm, source Markdown or server-side search process. Set MINIPROTO_DOCS_SITE during the Astro build because canonical metadata is prerendered. The container deliberately uses MINIPROTO_DOCS_BASE=/; deploy it at the origin root or configure the reverse proxy without adding a path prefix.

To build the site and package it in one Docker invocation, use the source-runtime target: docker build --file docs-site/Dockerfile --target source-runtime --build-arg MINIPROTO_DOCS_SITE=https://miniproto.edm115.dev --tag miniproto-docs .. It uses node:26-alpine and the pnpm version declared by docs-site/package.json (pnpm@12.23.0), then copies the output into nginxinc/nginx-unprivileged:stable-alpine. The source build uses Node’s default heap limit. To override it, pass --build-arg NODE_OPTIONS=--max-old-space-size=4096 to Docker. Build the site before Docker and use the default target when that headroom is unavailable. BuildKit caches the pnpm store, while every production build forces a fresh Astro content layer so imported Markdown-transform changes cannot leave stale rendered pages behind.

The documentation workflow builds and tests the site on pushes to master and on manual dispatch. It uploads the validated static artifact for inspection. Only builds from master publish that artifact at the root of gh-pages, preserving the branch history. Configure GitHub Pages to serve that branch from its root.