Skip to content

docker: install cargo-deny as a pinned prebuilt binary#175

Merged
pierre-warnier merged 1 commit into
mainfrom
ci/cargo-deny-prebuilt
Jun 10, 2026
Merged

docker: install cargo-deny as a pinned prebuilt binary#175
pierre-warnier merged 1 commit into
mainfrom
ci/cargo-deny-prebuilt

Conversation

@pierre-warnier

Copy link
Copy Markdown
Collaborator

Summary

The dev images built cargo-deny from source (cargo install cargo-deny). That recompiled it on every image build (several minutes ×3) and surfaced cargo-deny's own profile.dev.package.{insta,similar} warnings during the build:

warning: profile package spec `insta` in profile `dev` did not match any packages
warning: profile package spec `similar` in profile `dev` did not match any packages

Those look like our config but aren't — they're in cargo-deny's Cargo.toml (insta is its snapshot-test dep), emitted because cargo install resolves without dev-deps.

Change

Install the pinned, checksum-verified prebuilt cargo-deny binary instead (all three Dockerfiles). The static-musl build runs on glibc too, so one asset serves debian/alpine/fedora.

  • No source compile → faster image builds and no spurious warnings.
  • Reproducible: sha256-verified, version pinned via ARG (Renovate-trackable) — an improvement over the previous unpinned cargo install.
  • Each build self-validates with cargo-deny --version.

Validation

Built all three images locally — debian (glibc), alpine (musl/busybox), fedora (glibc/dnf):

  • /tmp/cargo-deny.tar.gz: OK (checksum) on each
  • cargo-deny 0.19.8 runs on each (confirms the static binary works across libc)
  • the insta/similar warnings are gone

Note: the CI Cargo Deny gate uses EmbarkStudios/cargo-deny-action and is unaffected; this only changes the local/dev Docker images.

The dev images built cargo-deny from source via `cargo install cargo-deny`.
That compiled cargo-deny on every image build (multi-minute) and surfaced
cargo-deny's own `profile.dev.package.{insta,similar}` warnings, which look
like our config but are not.

Install the pinned (0.19.8), checksum-verified prebuilt binary instead. The
static musl build runs on glibc too, so all three images share one asset.
Result: no source compile, no spurious warnings, and a reproducible,
sha256-verified install (vs the previous unpinned `cargo install`). Each
build self-checks with `cargo-deny --version`.

Version/checksum are ARGs so they can be bumped (and tracked by Renovate).
Copilot AI review requested due to automatic review settings June 10, 2026 13:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the development Docker images to install cargo-deny from a pinned, checksum-verified prebuilt release artifact rather than compiling it from source during image builds. This improves build time and avoids cargo-deny’s own profile warning noise that appears when installing from source via cargo install.

Changes:

  • Replace cargo install cargo-deny with a pinned cargo-deny release download + SHA256 verification.
  • Use the static x86_64-unknown-linux-musl artifact across Debian, Alpine, and Fedora images.
  • Add a self-check (cargo-deny --version) during build to validate the installed binary.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
docker/Dockerfile.fedora Downloads and installs pinned, checksum-verified cargo-deny binary into /root/.cargo/bin.
docker/Dockerfile.debian Downloads and installs pinned, checksum-verified cargo-deny binary into /usr/local/cargo/bin.
docker/Dockerfile.alpine Downloads and installs pinned, checksum-verified cargo-deny binary into /usr/local/cargo/bin.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pierre-warnier pierre-warnier merged commit 0442751 into main Jun 10, 2026
8 checks passed
@pierre-warnier pierre-warnier deleted the ci/cargo-deny-prebuilt branch June 10, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants