fix(release): inject buildinfo into Docker image binaries#243
Merged
Conversation
The Dockerfile compiled with bare `-s -w`, so binaries inside the published images reported "dev (none, unknown)" at startup and on --version. The build stage now takes VERSION / COMMIT / BUILD_DATE args wired to the same buildinfo ldflags GoReleaser uses, and the release workflow passes them (tag without the v prefix, commit SHA, UTC date). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
Binaries inside the published Docker images report
version="dev (none, unknown)"at startup and on--version— observed on the productionprosa-server/prosa-panelcontainers running the v0.21.2 images. The rootDockerfilecompiles with bare-s -w, without theinternal/buildinfoldflags that GoReleaser injects into the tarball binaries.Fix
Dockerfile: the sharedbuildstage takesVERSION/COMMIT/BUILD_DATEbuild args (defaulting to the existingdev/none/unknown) and wires them to the same-X github.com/c3-oss/prosa/internal/buildinfo.*ldflags GoReleaser uses.release.yml: a "Compute Docker build metadata" step mirrors GoReleaser's{{.Version}}/{{.Commit}}/{{.Date}}(tag without thevprefix, commit SHA, UTC RFC 3339 date) and all threebuild-push-actionsteps pass the args — identical args across the three targets, so the buildx cache for thebuildstage is still shared.docs/distribution/docker.md: the embedded Dockerfile excerpt and notes follow the change.Validation
Local build with args produces the expected output:
just lint-mdandjust qualitygreen. Takes effect on the next tagged release.🤖 Generated with Claude Code
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.