fix(release): give GoReleaser docker builds a separate release Dockerfile - #23
Merged
Merged
Conversation
…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>
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 a real failure from the actual
v0.1.1tag push (release run 32292141053):GoReleaser's docker build context only contains the Dockerfile, the binaries it already cross-compiled in the
builds:step, and whateverextra_files:lists — not the full repo. #19's rewrittenDockerfilestill had a multi-stageCOPY go.mod go.sum ./+COPY . .builder stage, which can never work in that context. Never caught locally because that PR's testing useddocker build .from the repo root (full source available) and--skip=dockersnapshot 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 bydocker-compose/local dev.Dockerfile.release(new): tiny alpine helper stage for CA certs + an empty/datadir, thenFROM scratchcopying the binaries GoReleaser already built. No rebuild-from-source — there's nothing to rebuild from in that context..goreleaser.yaml:dockers[].dockerfile→Dockerfile.release, addedextra_files: [configs]since that's not in the context either.Verified for real:
goreleaser release --snapshot --clean --skip=publishnow builds both docker images successfully (previously failed on this exact step). Ran the amd64 image viadocker run: server starts, version string correctly injected,/dashboard/returns 200. Image is 10.1MB.Once merged, will delete the broken
v0.1.1tag/release and re-cut it.