Skip to content

feat(rust): add Rust Dockerfile templates#15

Merged
kssd merged 1 commit into
mainfrom
worktree-rust-templates
May 14, 2026
Merged

feat(rust): add Rust Dockerfile templates#15
kssd merged 1 commit into
mainfrom
worktree-rust-templates

Conversation

@kssd
Copy link
Copy Markdown
Owner

@kssd kssd commented May 14, 2026

Summary

  • Implements issue [feat] Rust Dockerfile templates #8: Rust Dockerfile templates with cargo-chef dep-caching pattern
  • Dockerfile.rust — rust:1.82-slim builder + gcr.io/distroless/cc-debian12:nonroot runtime for GNU binaries; ARG BIN_NAME=app for configurable binary name
  • Dockerfile.rust.chainguardcgr.dev/chainguard/rust builder + cgr.dev/chainguard/glibc-dynamic runtime; ARG BASE_TAG=latest pattern avoids hadolint DL3007; digest-pinning documented in header comment
  • Dockerfile.devcontainermcr.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/ (can be multi-GB), .env, .git, .vscode
  • README.md — cargo-chef strategy, musl vs GNU table, digest-pinning workflow, devcontainer setup, hardening checklist
  • Root README.md updated: Rust added to intro sentence and ecosystems list, removed from "Coming soon"

Test plan

  • npm run lint passes (markdownlint, hadolint, prettier — all clean)
  • docker build --build-arg BIN_NAME=<bin> -f dockerfiles/rust/Dockerfile.rust . in a Rust project
  • docker build --build-arg BIN_NAME=<bin> -f dockerfiles/rust/Dockerfile.rust.chainguard . in a Rust project
  • Verify cargo-chef caching: second build after a code-only change skips cargo chef cook layer
  • Open dockerfiles/rust/ in VS Code Dev Containers and verify extensions load

Closes #8

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
@kssd kssd merged commit 73ac1f7 into main May 14, 2026
2 checks passed
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.

[feat] Rust Dockerfile templates

1 participant