Repository navigation
build: publish Docker images with GoReleaser - #884
Conversation
Build and push the Docker image in the release workflow, and remove the separate Docker Hub workflow that rebuilt the image after "🎉 Release Binary" finished. GoReleaser now builds the image with dockers_v2 from the binaries it compiles in the same run. The Dockerfile no longer builds mapcidr. It copies $TARGETPLATFORM/mapcidr from the GoReleaser build context and sets OCI labels. dockers_v2 replaces the deprecated dockers and docker_manifests. Rename release-binary.yml to release.yml and the workflow to "🎉 Release", since it now publishes images too. The workflow logs in to Docker Hub and switches from actions/setup-go and goreleaser/goreleaser-action to projectdiscovery/actions/setup/go and projectdiscovery/actions/goreleaser. With release: true, the goreleaser action sets up QEMU and Buildx before it runs goreleaser release. Tag images with the release tag, vX.Y, vX and latest. The old workflow pushed only the release tag and latest. Disable image builds for snapshot runs in CI. release-test runs a snapshot release on runners without QEMU, and image builds would fail there. Local snapshot runs still build images. Removing the old workflow also removes its workflow_dispatch trigger, so images can no longer be re-pushed without a release run. Build the 32-bit ARM image for linux/arm/v6 instead of linux/arm. GoReleaser stores the default GOARM=6 binary under linux/arm/v6, but buildx resolves linux/arm to arm/v7, where there is no binary. armv7 hosts can still run the arm/v6 image. Set CGO_ENABLED=0. Without it, the native linux/amd64 build links against glibc and does not start on Alpine. The linux/amd64 archive now ships the same static binary. Bump actions/checkout from v3 to v4 in the release workflow; actionlint rejects v3 as too old to run on GitHub Actions. Drop the go-version pin (1.24.0) so that setup/go uses the version from go.mod. setup/go sets GOTOOLCHAIN=local and go.mod requires Go 1.26.0, so the older pin fails the build. Add version: 2 and replace the deprecated archives format key with formats; goreleaser check flagged both. Archive names do not change. Closes #881 Fixes #882 Fixes #883 Signed-off-by: Dwi Siswanto <git@dw1.io>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. WalkthroughThe Dockerfile now uses Alpine 3.18.3 directly and copies a platform-specific prebuilt binary into ChangesDocker image assembly
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The image’s root default supports the self-update path. No actionable Dockerfile issue remains in the reviewed scope. 🚥 Pre-merge checks | ✅ 4 | ❓ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The Dockerfile evidence supports Resolution Provide reviewable evidence for ✨ Finishing Touches🧪 Generate unit tests (beta)
I’m a rabbit with a Dockerfile to greet, Comment |
Mzack9999
left a comment
There was a problem hiding this comment.
This matches the request. The image is built from the release binaries in the same GoReleaser run, with the release tag, vX.Y, vX, and latest.
Build and push the Docker image in the release workflow, and remove the separate Docker Hub workflow that rebuilt the image after "🎉 Release Binary" finished.
GoReleaser now builds the image with dockers_v2 from the binaries it compiles in the same run. The Dockerfile no longer builds mapcidr. It copies $TARGETPLATFORM/mapcidr from the GoReleaser build context and sets OCI labels. dockers_v2 replaces the deprecated dockers and docker_manifests.
Rename release-binary.yml to release.yml and the workflow to "🎉 Release", since it now publishes images too. The workflow logs in to Docker Hub and switches from actions/setup-go and goreleaser/goreleaser-action to projectdiscovery/actions/setup/go and projectdiscovery/actions/goreleaser. With release: true, the goreleaser action sets up QEMU and Buildx before it runs goreleaser release.
Tag images with the release tag, vX.Y, vX and latest. The old workflow pushed only the release tag and latest.
Disable image builds for snapshot runs in CI. release-test runs a snapshot release on runners without QEMU, and image builds would fail there. Local snapshot runs still build images.
Removing the old workflow also removes its workflow_dispatch trigger, so images can no longer be re-pushed without a release run.
Build the 32-bit ARM image for linux/arm/v6 instead of linux/arm. GoReleaser stores the default GOARM=6 binary under linux/arm/v6, but buildx resolves linux/arm to arm/v7, where there is no binary. armv7 hosts can still run the arm/v6 image.
Set CGO_ENABLED=0. Without it, the native linux/amd64 build links against glibc and does not start on Alpine. The linux/amd64 archive now ships the same static binary.
Bump actions/checkout from v3 to v4 in the release workflow; actionlint rejects v3 as too old to run on GitHub Actions.
Drop the go-version pin (1.24.0) so that setup/go uses the version from go.mod. setup/go sets GOTOOLCHAIN=local and go.mod requires Go 1.26.0, so the older pin fails the build.
Add version: 2 and replace the deprecated archives format key with formats; goreleaser check flagged both. Archive names do not change.
Closes #881
Fixes #882
Fixes #883
Summary by CodeRabbit
mapcidrexecutable.