mirror of
https://github.com/containers/bootc.git
synced 2026-02-05 06:45:13 +01:00
When cargo-binstall fetches pre-built binaries from GitHub, it can hit API rate limits (403 Forbidden) when unauthenticated. This causes it to fall back to building from source, which fails for mdbook-linkcheck because the devenv container lacks openssl-devel and the perl modules needed to build OpenSSL from source. Pass the GitHub Actions token through to the container build as a secret, allowing cargo-binstall to make authenticated requests with higher rate limits. Assisted-by: OpenCode (claude-sonnet-4-20250514) Signed-off-by: Colin Walters <walters@verbum.org>
37 lines
1.3 KiB
Docker
37 lines
1.3 KiB
Docker
FROM ghcr.io/bootc-dev/devenv-c10s:latest
|
|
USER root
|
|
# Install mdbook tooling via cargo-binstall
|
|
# The GH_TOKEN secret is used to avoid GitHub API rate limits when fetching
|
|
# pre-built binaries. Without it, binstall falls back to building from source.
|
|
RUN --mount=type=secret,id=GH_TOKEN <<EORUN
|
|
set -xeuo pipefail
|
|
if test -f /run/secrets/GH_TOKEN; then
|
|
export GH_TOKEN=$(cat /run/secrets/GH_TOKEN)
|
|
fi
|
|
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
|
deps=(mdbook@0.4.52
|
|
mdbook-mermaid@0.16.0
|
|
mdbook-linkcheck@0.7.7
|
|
mdbook_header_footer@0.0.3)
|
|
cargo binstall --no-confirm --root /usr/local ${deps[@]}
|
|
EORUN
|
|
# And now actually build the docs
|
|
WORKDIR /src
|
|
COPY . /src
|
|
RUN --mount=type=cache,target=/src/target <<EORUN
|
|
set -xeuo pipefail
|
|
# Build rustdoc for internal crates
|
|
cargo doc --workspace --no-deps --document-private-items
|
|
# Also build docs for key external git dependencies (not on docs.rs)
|
|
cargo doc --no-deps --document-private-items -p composefs -p composefs-boot -p composefs-oci
|
|
# Build mdbook
|
|
cd docs
|
|
mdbook-mermaid install .
|
|
mdbook build
|
|
# Copy rustdoc into mdbook output
|
|
cp -r /src/target/doc book/internals
|
|
EORUN
|
|
WORKDIR /src/docs/book
|
|
CMD ["python3", "-m", "http.server", "8000", "--bind", "0.0.0.0"]
|
|
EXPOSE 8000
|