镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Add a container image and pre-commit hooks - #12

Open
devblac wants to merge 1 commit into
fix/v0.1.1from
feat/pre-commit-docker
Open

devblac wants to merge 1 commit into
fix/v0.1.1from
feat/pre-commit-docker

Conversation

@devblac

@devblac devblac commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Stacked on #11 (base fix/v0.1.1); retarget to main after #11 merges. Meant for v0.1.1.

Container image

  • Dockerfile: static binary on distroless/static-debian12:nonroot (UID 65532), 2.5 MB, linux/amd64 + linux/arm64. The build stage cross-compiles, so no QEMU is needed. It passes docker-lint --strict on itself.
  • .github/workflows/image.yml:
    • PRs: build, test (stdin, mounted dir, exit codes, self-lint) and a multi-platform build without pushing.
    • release: published: push to ghcr.io/devblac/docker-lint with tags 0.1.1, 0.1 and latest. It runs on publish, not on the tag, so nothing is public before the release is.
  • First publish: the ghcr package starts private and must be made public once (documented in CONTRIBUTING).

pre-commit

.pre-commit-hooks.yaml adds two hooks:

  • docker-lint: language: golang.
  • docker-lint-docker: runs the image.

Both match the same Dockerfile names as directory search and skip templates. release.yml fails if the image hook names a different version than the tag.

Tested locally

  • Built the image (amd64 + arm64) and ran it via stdin and a read-only mounted directory, checking UID, size and --version build info.
  • pre-commit try-repo with both hooks on a sample repo: lints staged Dockerfiles, skips Dockerfile.template, reads .docker-lint.yaml, fails the commit on errors. The Docker hook was tested with the local image tagged as 0.1.1, and the tag was removed afterwards.
  • The release version check passes for v0.1.1 and fails for another version.

🤖 Generated with Claude Code

The image is a static docker-lint on distroless, running as a non-root
user, for linux/amd64 and linux/arm64. Pull requests build and test it;
publishing a release pushes it to ghcr.io, so nothing is public before
the release is. Its own Dockerfile passes docker-lint --strict.

Two pre-commit hooks lint staged Dockerfiles, skipping templates as a
directory search does: docker-lint builds the binary with Go, and
docker-lint-docker runs the image. The release workflow fails if the
image hook names another version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T06:53:50.505564Z ee21da5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

1 participant