Skip to content

CI: hadolint every Dockerfile and build changed ones on PRs - #3747

Merged
goastler merged 2 commits into
mainfrom
ci/docker-lint-build
Nov 6, 2026
Merged

goastler merged 2 commits into
mainfrom
ci/docker-lint-build

Conversation

@goastler

@goastler goastler commented Nov 6, 2026

Copy link
Copy Markdown
Member

What changed

  • New .github/workflows/docker.yml, run on PRs that touch a Dockerfile:
    • hadolint: lints all five tracked Dockerfiles. Fails if a Dockerfile exists that is not in its list.
    • docker-build: builds the caddy and vector images (never pushes) when this PR changed their Dockerfile, the workflow, or .hadolint.yaml.
  • New .hadolint.yaml: apt/apk version pinning (DL3008/DL3018) is off, since a pinned distro package breaks rebuilds once the archive drops it. Info-level findings print but do not fail.
  • Not built here, with the reason recorded in the workflow (# docker build opt-out: ...):
    • the two demo images only copy the bundle that the pnpm build makes. captcha-private's publish_services.yml builds them.
    • packages/cli is already built on PRs by provider_image.yml.
  • Two Dockerfile fixes hadolint asked for:
    • caddy writes robots.txt with printf instead of echo -e, which plain sh does not define. The file contents are the same.
    • vector writes Docker's apt source with a redirect instead of | tee.

Why a new workflow file
There is no shared docker stage yet, so this is a per-concern workflow next to lint.yml, tests.yml and the others. It needs a code-owner review under the workflow-structure rule.

Effect
A broken or badly written Dockerfile now fails on its PR, not later in a publish run.

Tests

  • actionlint passes. hadolint 2.14.0 with this config passes on all five files locally.
  • This PR changes the workflow, so CI builds both images here.

Adds a docker workflow: hadolint over every tracked Dockerfile (failing when
one is not listed) and a no-push build of the caddy and vector images when
their Dockerfile changes. The bundle-only images and the cli image (already
built by provider_image.yml) record why they are not built here.

Fixes the two findings hadolint raised: caddy's robots.txt is written with
printf rather than sh's undefined echo -e, and vector's apt source is written
by redirect rather than through a pipe into tee.
@goastler
goastler marked this pull request as ready for review November 6, 2026 05:07
@goastler
goastler enabled auto-merge (squash) November 6, 2026 05:43
@prosoponator prosoponator added the auto-update Branch kept up to date by auto-update-pr label Nov 6, 2026
@goastler
goastler merged commit 2bc5740 into main Nov 6, 2026
36 checks passed
@goastler
goastler deleted the ci/docker-lint-build branch November 6, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-update Branch kept up to date by auto-update-pr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants