-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.docs
More file actions
31 lines (24 loc) · 1 KB
/
Dockerfile.docs
File metadata and controls
31 lines (24 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Dockerfile.docs — builds rustdoc and serves it as static files via Caddy.
#
# Uses cargo-chef so dependency compilation is cached separately from source
# changes. After the first build, only workspace crates are re-documented.
FROM lukemathwalker/cargo-chef:latest-rust-1.91-bookworm AS chef
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
# Compile deps without --release; cached until Cargo.toml / Cargo.lock change.
RUN cargo chef cook --recipe-path recipe.json
COPY . .
RUN cargo doc --no-deps --workspace --document-private-items
# Copy diagram PNGs so relative <img> links in embedded markdown resolve.
RUN cp docs/*.png target/doc/kuma_core/
FROM caddy:2-alpine
COPY --from=builder /app/target/doc /srv/docs
CMD ["caddy", "file-server", "--root", "/srv/docs", "--listen", ":80"]