Skip to content

fix(docker): stamp version metadata into the published image - #427

Merged
Joseph94m merged 1 commit into
mainfrom
fix/docker-image-version-stamp
Aug 21, 2026
Merged

fix(docker): stamp version metadata into the published image#427
Joseph94m merged 1 commit into
mainfrom
fix/docker-image-version-stamp

Conversation

@thomasboni

Copy link
Copy Markdown
Contributor

Fixes #425

Problem

plumber version inside the published Docker image reports:

plumber version dev
  commit: none
  built:  unknown

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, whose go build only passes -s -w. The binary in the image therefore keeps the compile-time defaults from cmd/version.go (dev / none / unknown).

Fix

  • Dockerfile: add VERSION / COMMIT / BUILD_DATE build args (defaulting to the current dev values) and feed them into the same -X ldflags the release binaries use. The args are declared after the dependency layers so a changing BUILD_DATE never invalidates the go mod download cache.
  • release.yml (docker job): pass the three build args to docker/build-push-action, with COMMIT=${{ github.sha }} matching what the release binaries embed and BUILD_DATE computed in the same format as the binary build step.

Plain docker build with 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:

    plumber version 9.9.9-test
      commit: abc1234def
      built:  2026-08-21T00:00:00Z
    
  • with no build args (ci.yml path): unchanged dev / none / unknown defaults.

The published image will pick this up at the next release.

🤖 Generated with Claude Code

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>
@Joseph94m
Joseph94m merged commit f88e404 into main Aug 21, 2026
16 checks passed
@Joseph94m
Joseph94m deleted the fix/docker-image-version-stamp branch August 21, 2026 11:43
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.

dev version shown when using docker image

2 participants