Skip to content

feat(zig): add Zig Dockerfile templates#17

Merged
kssd merged 2 commits into
mainfrom
worktree-zig-templates
May 15, 2026
Merged

feat(zig): add Zig Dockerfile templates#17
kssd merged 2 commits into
mainfrom
worktree-zig-templates

Conversation

@kssd
Copy link
Copy Markdown
Owner

@kssd kssd commented May 14, 2026

Summary

  • Implements issue [feat] Zig Dockerfile templates #11: Zig Dockerfile templates with SHA-256-verified tarball installation, distroless/static runtime, Chainguard variant, and devcontainer
  • Dockerfile.zigdebian:bookworm-slim builder downloads and SHA-256-verifies the Zig 0.16.0 tarball (pinned per arch: x86_64 + aarch64); builds with ARG ZIG_OPTIMIZE=ReleaseSafe; runtime gcr.io/distroless/static-debian12:nonroot (fully-static: Zig bundles musl libc)
  • Dockerfile.zig.chainguardcgr.dev/chainguard/wolfi-base builder (cgr.dev/chainguard/zig is a paid tier); same tarball install pattern; runtime cgr.dev/chainguard/static; apk versions pinned (DL3018); SHELL /bin/ash -eo pipefail (DL4006)
  • Dockerfile.devcontainermcr.microsoft.com/devcontainers/base:1-bookworm with Zig 0.16.0 + ZLS 0.16.0 (prebuilt binary from zigtools/zls releases), gdb, lldb, valgrind
  • .devcontainer/devcontainer.jsonziglang.vscode-zig, vadimcn.vscode-lldb; zig.path and zig.zls.path wired to installed binaries
  • .dockerignore — excludes zig-cache/, .zig-cache/, zig-out/
  • README.md — tarball supply-chain rationale, SHA-256 upgrade guide, optimize modes table, zig build vs zig build-exe, cross-compilation, libc linking note, hardening checklist
  • Root README.md — Zig added to intro sentence, new Zig section, "Coming soon" updated

Test plan

  • npm run lint passes (markdownlint, hadolint, prettier — all clean)
  • docker build --build-arg BIN_NAME=<bin> -f dockerfiles/zig/Dockerfile.zig . in a Zig project
  • docker build --build-arg BIN_NAME=<bin> -f dockerfiles/zig/Dockerfile.zig.chainguard .
  • Verify SHA-256 check: tamper the hash constant → build must fail at sha256sum -c
  • Multi-arch: docker buildx build --platform=linux/amd64,linux/arm64 ... both build cleanly
  • Open dockerfiles/zig/ in VS Code Dev Containers and verify zig version + zls --version in terminal

Closes #11

kssd added 2 commits May 14, 2026 22:03
Implements issue #11. Zig's tarball distribution requires explicit
SHA-256 verification — there is no package-manager signature chain —
so both Dockerfiles download the official tarball and verify it with
sha256sum before extracting.

- Dockerfile.zig: debian:bookworm-slim builder downloads and verifies
  Zig 0.16.0 tarball (SHA-256 pinned per arch); builds with
  ARG ZIG_OPTIMIZE=ReleaseSafe; runtime distroless/static-debian12:nonroot
  (fully-static: Zig bundles musl libc by default)
- Dockerfile.zig.chainguard: cgr.dev/chainguard/wolfi-base builder
  (cgr.dev/chainguard/zig is a paid tier); same tarball install pattern;
  runtime cgr.dev/chainguard/static; apk versions pinned (DL3018);
  SHELL set to /bin/ash -eo pipefail (DL4006) for busybox compatibility
- Dockerfile.devcontainer: mcr.microsoft.com/devcontainers/base:1-bookworm
  with Zig + ZLS 0.16.0 (prebuilt binary from zigtools/zls releases),
  gdb, lldb, valgrind; both toolchain installs SHA-256 verified
- .devcontainer/devcontainer.json: ziglang.vscode-zig, vscode-lldb;
  zig.path and zig.zls.path wired to installed binaries
- .dockerignore: excludes zig-cache/, .zig-cache/, zig-out/
- README.md: tarball supply-chain rationale, optimize modes table,
  zig build vs zig build-exe, cross-compilation, version upgrade guide,
  libc linking note, hardening checklist

Closes #11
The devcontainer comment claimed both Zig and ZLS were SHA-256 verified
but the ZLS install block was missing the sha256sum check. Add the
per-arch SHA-256 values (0.16.0 x86_64 and aarch64) and the
verification step, consistent with the Zig tarball install above it.
@kssd kssd merged commit 384c6c3 into main May 15, 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] Zig Dockerfile templates

1 participant