fix(docker): stamp version metadata into the published image - #427
Merged
Conversation
The published Docker image reported "plumber version dev" (commit: none, built: unknown) because the Dockerfile built the binary without the -X ldflags that release.yml applies to the release binaries. Add VERSION / COMMIT / BUILD_DATE build args to the Dockerfile, feed them into -X ldflags on cmd/version.go, and pass them from the release workflow's docker job. Plain builds (ci.yml, local) keep the dev defaults. Fixes #425 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
thomasboni
requested review from
Joseph94m,
Totara-thib and
coconux3
as code owners
August 21, 2026 08:52
Joseph94m
approved these changes
Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #425
Problem
plumber versioninside the published Docker image reports:while the downloaded release binaries report the real version.
Root cause
release.yml stamps the release binaries with
-X github.com/getplumber/plumber/cmd.Version=... / cmd.Commit=... / cmd.BuildDate=...ldflags, but the docker job builds the image straight from the Dockerfile, whosego buildonly passes-s -w. The binary in the image therefore keeps the compile-time defaults fromcmd/version.go(dev/none/unknown).Fix
VERSION/COMMIT/BUILD_DATEbuild args (defaulting to the current dev values) and feed them into the same-Xldflags the release binaries use. The args are declared after the dependency layers so a changingBUILD_DATEnever invalidates thego mod downloadcache.docker/build-push-action, withCOMMIT=${{ github.sha }}matching what the release binaries embed andBUILD_DATEcomputed in the same format as the binary build step.Plain
docker buildwith no args (ci.yml grype scan, local builds) keeps today's dev output.Verification
Built the image locally from this branch:
with
--build-arg VERSION=9.9.9-test --build-arg COMMIT=abc1234def --build-arg BUILD_DATE=2026-08-21T00:00:00Z:with no build args (ci.yml path): unchanged
dev/none/unknowndefaults.The published image will pick this up at the next release.
🤖 Generated with Claude Code