Skip to content

fix(docker): pin templ CLI to the go.mod runtime version - #12

Merged
tompscanlan merged 1 commit into
mainfrom
ci/pin-templ-dockerfile
Jul 17, 2026
Merged

fix(docker): pin templ CLI to the go.mod runtime version#12
tompscanlan merged 1 commit into
mainfrom
ci/pin-templ-dockerfile

Conversation

@tompscanlan

Copy link
Copy Markdown
Contributor

What

The post-merge prod build for survey (Build & Deploy Survey to Prod) failed at the Docker builder stage:

go install github.com/a-h/templ/cmd/templ@latest
go: github.com/a-h/templ@v0.3.1020 requires go >= 1.25.0 (running go 1.24.13; GOTOOLCHAIN=local)

@latest drifted to v0.3.1020, which now requires Go ≥ 1.25, but the builder image is golang:1.24-alpine. The unit-test job hit the same drift and was pinned in #11; the Dockerfile wasn't, so the prod image build broke.

Fix

Pin the builder's templ CLI to v0.3.960, matching the runtime in go.mod:

  • v0.3.960 requires Go 1.23 → builds on the 1.24 builder ✔
  • templ generate with v0.3.960 produces zero diff vs the committed *_templ.go, and go build ./... passes ✔
  • CLI now matches the runtime version — no more drift

Formatting/behavior of the image is unchanged; this only fixes the build.

Note (not in this PR)

Dockerfile:34 still installs golang-migrate via @latest, another unpinned tool that could drift the same way. Left as-is to keep this fix surgical — worth pinning in a follow-up.

The builder stage ran `go install .../templ@latest`. `@latest` now resolves to
v0.3.1020, which requires Go >= 1.25, but the builder is golang:1.24-alpine
(GOTOOLCHAIN=local) — so the prod image build fails at `templ generate`.

Pin the CLI to v0.3.960 to match go.mod's runtime (requires Go 1.23; builds on
the 1.24 builder). Regeneration produces zero diff and `go build ./...` passes.
The CI test job was already pinned in #11; this aligns the Dockerfile.
@tompscanlan
tompscanlan merged commit db45e62 into main Jul 17, 2026
3 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.

1 participant