Skip to content

fix(release): inject buildinfo into Docker image binaries#243

Merged
upsetbit merged 1 commit into
masterfrom
fix/docker-buildinfo
Jun 12, 2026
Merged

fix(release): inject buildinfo into Docker image binaries#243
upsetbit merged 1 commit into
masterfrom
fix/docker-buildinfo

Conversation

@upsetbit

@upsetbit upsetbit commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Problem

Binaries inside the published Docker images report version="dev (none, unknown)" at startup and on --version — observed on the production prosa-server/prosa-panel containers running the v0.21.2 images. The root Dockerfile compiles with bare -s -w, without the internal/buildinfo ldflags that GoReleaser injects into the tarball binaries.

Fix

  • Dockerfile: the shared build stage takes VERSION / COMMIT / BUILD_DATE build args (defaulting to the existing dev / 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 the v prefix, commit SHA, UTC RFC 3339 date) and all three build-push-action steps pass the args — identical args across the three targets, so the buildx cache for the build stage 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:

$ docker build --target prosa --build-arg VERSION=0.0.0-test --build-arg COMMIT=abc1234 --build-arg BUILD_DATE=2026-06-12T00:00:00Z -t t .
$ docker run --rm t --version
prosa version 0.0.0-test (abc1234, 2026-06-12T00:00:00Z)

just lint-md and just quality green. Takes effect on the next tagged release.

🤖 Generated with Claude Code


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

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>
@upsetbit upsetbit merged commit e47b8d0 into master Jun 12, 2026
5 checks passed
@upsetbit upsetbit deleted the fix/docker-buildinfo branch June 12, 2026 05:25
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