Slim the Rust toolchain in the agent image #308

Open
opened 2026-09-21 16:57:55 +00:00 by sharang · 0 comments
Owner

Follow-up from #261 (PR #307). After Nix and the unused runtimes were removed, the Rust toolchain is the largest layer in the agent image: about 626 MB uncompressed, for the minimal profile with rustc, cargo and rust-std.

The runtime only needs cargo for cargo generate-lockfile and cargo metadata (SBOM resolution), plus cargo-audit, which is already a standalone binary. cargo metadata calls rustc for target info, so rustc stays. The host rust-std is probably not needed.

Try: drop rust-std from the runtime toolchain, or copy just cargo and rustc from the builder image. Then check that lockfile generation and metadata still work on a real crate (the itoa scan used in #307).

Acceptance: the itoa scan still gives the same SBOM, and the agent image is measurably smaller.

Follow-up from #261 (PR #307). After Nix and the unused runtimes were removed, the Rust toolchain is the largest layer in the agent image: about 626 MB uncompressed, for the minimal profile with rustc, cargo and rust-std. The runtime only needs cargo for `cargo generate-lockfile` and `cargo metadata` (SBOM resolution), plus cargo-audit, which is already a standalone binary. `cargo metadata` calls `rustc` for target info, so rustc stays. The host `rust-std` is probably not needed. **Try:** drop `rust-std` from the runtime toolchain, or copy just `cargo` and `rustc` from the builder image. Then check that lockfile generation and metadata still work on a real crate (the itoa scan used in #307). **Acceptance:** the itoa scan still gives the same SBOM, and the agent image is measurably smaller.
sharang added this to the R1 · Dynamic & OT depth milestone 2026-09-21 16:57:55 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#308