feat(rust): add Rust Dockerfile templates#15
Merged
Conversation
Implements issue #8. Adds cargo-chef dep-caching pattern to isolate the dependency-compile layer from application source — code-only rebuilds skip the expensive cargo cook step entirely. - Dockerfile.rust: rust:1.82-slim builder + distroless/cc-debian12 runtime for GNU binaries; ARG BIN_NAME=app - Dockerfile.rust.chainguard: cgr.dev/chainguard/rust builder + cgr.dev/chainguard/glibc-dynamic runtime; ARG BASE_TAG=latest pattern avoids DL3007; digest-pinning documented in header - Dockerfile.devcontainer: mcr.microsoft.com/devcontainers/rust:1-bookworm with cargo-edit, cargo-watch, cargo-nextest, cargo-chef - .devcontainer/devcontainer.json: rust-analyzer (clippy mode), vscode-lldb, even-better-toml, crates, dependi extensions - .dockerignore: excludes target/ (multi-GB), .env, .git, .vscode - README.md: cargo-chef strategy, musl vs GNU table, digest-pinning, devcontainer setup, hardening checklist Closes #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Dockerfile.rust— rust:1.82-slim builder +gcr.io/distroless/cc-debian12:nonrootruntime for GNU binaries;ARG BIN_NAME=appfor configurable binary nameDockerfile.rust.chainguard—cgr.dev/chainguard/rustbuilder +cgr.dev/chainguard/glibc-dynamicruntime;ARG BASE_TAG=latestpattern avoids hadolint DL3007; digest-pinning documented in header commentDockerfile.devcontainer—mcr.microsoft.com/devcontainers/rust:1-bookwormwith cargo-edit, cargo-watch, cargo-nextest, cargo-chef.devcontainer/devcontainer.json— rust-analyzer (clippy mode), vscode-lldb, even-better-toml, crates, dependi extensions.dockerignore— excludestarget/(can be multi-GB),.env,.git,.vscodeREADME.md— cargo-chef strategy, musl vs GNU table, digest-pinning workflow, devcontainer setup, hardening checklistREADME.mdupdated: Rust added to intro sentence and ecosystems list, removed from "Coming soon"Test plan
npm run lintpasses (markdownlint, hadolint, prettier — all clean)docker build --build-arg BIN_NAME=<bin> -f dockerfiles/rust/Dockerfile.rust .in a Rust projectdocker build --build-arg BIN_NAME=<bin> -f dockerfiles/rust/Dockerfile.rust.chainguard .in a Rust projectcargo chef cooklayerdockerfiles/rust/in VS Code Dev Containers and verify extensions loadCloses #8