Skip to content

Commit b68100b

Browse files
committed
docs: Publish rustdoc for internal crates alongside mdbook
The docs workflow now also generates rustdoc for all workspace crates and publishes them as a subdirectory of the main documentation site. This makes internal API documentation available at bootc-dev.github.io/bootc/internals.html with links to each crate. Note this required switching the docs container to CentOS Stream 10 for newer Rust (1.91). Assisted-by: OpenCode (Opus 4.5) Signed-off-by: Colin Walters <walters@verbum.org>
1 parent 2a4476c commit b68100b

4 files changed

Lines changed: 43 additions & 19 deletions

File tree

Justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,15 @@ pullspec-for-os TYPE NAME:
233233
@jq -r --arg v "{{NAME}}" '."{{TYPE}}"[$v]' < hack/os-image-map.json
234234

235235
build-mdbook:
236-
cd docs && podman build {{base_buildargs}} -t localhost/bootc-mdbook -f Dockerfile.mdbook
236+
podman build {{generic_buildargs}} -t localhost/bootc-mdbook -f docs/Dockerfile.mdbook .
237237

238238
# Generate the rendered HTML to the target DIR directory
239239
build-mdbook-to DIR: build-mdbook
240240
#!/bin/bash
241241
set -xeuo pipefail
242242
# Create a temporary container to extract the built docs
243243
container_id=$(podman create localhost/bootc-mdbook)
244-
podman cp ${container_id}:/src/book {{DIR}}
244+
podman cp ${container_id}:/src/docs/book {{DIR}}
245245
podman rm -f ${container_id}
246246

247247
mdbook-serve: build-mdbook

docs/Dockerfile.mdbook

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
1-
FROM registry.access.redhat.com/ubi10/ubi:latest
2-
# An intermediate layer which caches the RPMS
1+
FROM ghcr.io/bootc-dev/devenv-c10s:latest
2+
USER root
3+
# Install mdbook tooling via cargo-binstall
34
RUN <<EORUN
45
set -xeuo pipefail
5-
dnf -y install cargo rust jq unzip
6-
dnf clean all
7-
EORUN
8-
# See main Dockerfile for rust caching
9-
RUN --mount=type=cache,target=/src/target --mount=type=cache,target=/var/roothome <<EORUN
10-
set -xeuo pipefail
11-
12-
# Bootstrap cargo-binstall
13-
export PATH=$HOME/.cargo/bin:$PATH
146
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
15-
167
deps=(mdbook@0.4.52
178
mdbook-mermaid@0.16.0
189
mdbook-linkcheck@0.7.7
1910
mdbook_header_footer@0.0.3)
20-
cargo binstall --no-confirm ${deps[@]}
21-
mv ~/.cargo/bin/* /usr/bin/
22-
11+
cargo binstall --no-confirm --root /usr/local ${deps[@]}
2312
EORUN
2413
# And now actually build the docs
2514
WORKDIR /src
2615
COPY . /src
27-
RUN <<EORUN
16+
RUN --mount=type=cache,target=/src/target <<EORUN
2817
set -xeuo pipefail
18+
# Build rustdoc for internal crates
19+
cargo doc --workspace --no-deps --document-private-items
20+
# Build mdbook
21+
cd docs
2922
mdbook-mermaid install .
3023
mdbook build
24+
# Copy rustdoc into mdbook output
25+
cp -r /src/target/doc book/internals
3126
EORUN
32-
CMD ["mdbook", "serve", "-n", "0.0.0.0", "-p", "8000"]
27+
WORKDIR /src/docs/book
28+
CMD ["python3", "-m", "http.server", "8000", "--bind", "0.0.0.0"]
3329
EXPOSE 8000

docs/src/SUMMARY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,7 @@
7070
- [Relationship with other projects](relationships.md)
7171
- [Relationship with OCI artifacs](relationship-oci-artifacts.md)
7272
- [Relationship with systemd "particles"](relationship-particles.md)
73+
74+
# Development
75+
76+
- [Internals (rustdoc)](internals.md)

docs/src/internals.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Internals (rustdoc)
2+
3+
This section provides rustdoc API documentation for bootc's internal crates.
4+
These are intended for developers working on bootc itself, not for external consumption.
5+
6+
## Core crates
7+
8+
- [bootc-lib](internals/bootc_lib/index.html) - Core bootc implementation
9+
- [bootc](internals/bootc/index.html) - CLI frontend
10+
11+
## Supporting crates
12+
13+
- [ostree-ext](internals/ostree_ext/index.html) - Extension APIs for OSTree
14+
- [bootc-mount](internals/bootc_mount/index.html) - Internal mount utilities
15+
- [bootc-kernel-cmdline](internals/bootc_kernel_cmdline/index.html) - Kernel command line parsing
16+
- [bootc-initramfs-setup](internals/bootc_initramfs_setup/index.html) - Initramfs setup code
17+
- [etc-merge](internals/etc_merge/index.html) - /etc merge handling
18+
19+
## Utility crates
20+
21+
- [bootc-internal-utils](internals/bootc_internal_utils/index.html) - Internal utilities
22+
- [bootc-internal-blockdev](internals/bootc_internal_blockdev/index.html) - Block device handling
23+
- [bootc-sysusers](internals/bootc_sysusers/index.html) - systemd-sysusers implementation
24+
- [bootc-tmpfiles](internals/bootc_tmpfiles/index.html) - systemd-tmpfiles implementation

0 commit comments

Comments
 (0)