Skip to content

fix(release): give GoReleaser docker builds a separate release Dockerfile - #23

Merged
shreyanshjain7174 merged 1 commit into
mainfrom
fix/goreleaser-docker-build-context
Aug 19, 2026
Merged

fix(release): give GoReleaser docker builds a separate release Dockerfile#23
shreyanshjain7174 merged 1 commit into
mainfrom
fix/goreleaser-docker-build-context

Conversation

@shreyanshjain7174

Copy link
Copy Markdown
Contributor

Fixes a real failure from the actual v0.1.1 tag push (release run 32292141053):

ERROR: failed to build: failed to solve: failed to compute cache key: ... "/configs": not found

GoReleaser's docker build context only contains the Dockerfile, the binaries it already cross-compiled in the builds: step, and whatever extra_files: lists — not the full repo. #19's rewritten Dockerfile still had a multi-stage COPY go.mod go.sum ./ + COPY . . builder stage, which can never work in that context. Never caught locally because that PR's testing used docker build . from the repo root (full source available) and --skip=docker snapshot builds — the PR body said as much: "Not yet tested: a real end-to-end tag-triggered CI run." This was that first real run.

Fix: two Dockerfiles instead of one trying to serve both contexts.

  • Dockerfile (unchanged behavior): multi-stage, builds from source. Used by docker-compose/local dev.
  • Dockerfile.release (new): tiny alpine helper stage for CA certs + an empty /data dir, then FROM scratch copying the binaries GoReleaser already built. No rebuild-from-source — there's nothing to rebuild from in that context.
  • .goreleaser.yaml: dockers[].dockerfileDockerfile.release, added extra_files: [configs] since that's not in the context either.

Verified for real: goreleaser release --snapshot --clean --skip=publish now builds both docker images successfully (previously failed on this exact step). Ran the amd64 image via docker run: server starts, version string correctly injected, /dashboard/ returns 200. Image is 10.1MB.

Once merged, will delete the broken v0.1.1 tag/release and re-cut it.

…file

The v0.1.1 tag push failed release.yml for real:

  ERROR: failed to build: failed to solve: failed to compute cache
  key: ... "/configs": not found

GoReleaser's docker build context only contains the Dockerfile, the
binaries it already cross-compiled in the builds: step, and whatever
extra_files: lists -- not the full repo. The rewritten Dockerfile from
#19 still had a multi-stage 'COPY go.mod go.sum ./' + 'COPY . .'
builder stage, which can never work in that context. This was never
caught because #19's local testing used 'docker build .' from the
repo root (full source available) and --skip=docker snapshot builds,
and the PR itself said as much: "Not yet tested: a real end-to-end
tag-triggered CI run." This is that first real run.

Fix: split into two Dockerfiles instead of trying to make one work in
both contexts.

- Dockerfile (unchanged behavior): multi-stage, builds from source.
  Used by docker-compose / local dev, where the full repo is the
  build context.
- Dockerfile.release (new): single small alpine helper stage for CA
  certs + an empty /data dir, then FROM scratch copying the binaries
  GoReleaser already built. Doesn't rebuild from source -- there's
  nothing to rebuild from in that context, and GoReleaser already did
  the cross-compile.
- .goreleaser.yaml: dockers[].dockerfile -> Dockerfile.release,
  added extra_files: [configs] since that's not in the context either.

Verified for real: 'goreleaser release --snapshot --clean --skip=publish'
now builds both docker images successfully (previously failed on
this exact step). Ran the amd64 image via 'docker run' (under QEMU,
darwin/arm64 host): server starts, version string correctly injected
(0.1.1-SNAPSHOT-1d9c395), 'curl .../dashboard/' returns 200. Image is
10.1MB.

Signed-off-by: Shreyansh Sancheti <43677304+shreyanshjain7174@users.noreply.github.com>
@shreyanshjain7174
shreyanshjain7174 merged commit a5a3286 into main Aug 19, 2026
1 check passed
@shreyanshjain7174
shreyanshjain7174 deleted the fix/goreleaser-docker-build-context branch August 19, 2026 19:26
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