Skip to content

build: publish Docker images with GoReleaser - #884

Merged
dwisiswant0 merged 2 commits into
mainfrom
dwisiswant0/build/publish-docker-images-with-goreleaser
Oct 8, 2026
Merged

dwisiswant0 merged 2 commits into
mainfrom
dwisiswant0/build/publish-docker-images-with-goreleaser

Conversation

@dwisiswant0

@dwisiswant0 dwisiswant0 commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

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

  • Updates
    • The container image now uses the latest Alpine release and includes a prebuilt mapcidr executable.
    • Image metadata now includes author, description, license, title, and project URL details.
    • DNS utilities, CA certificates, and the existing startup behavior remain available.

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>
@dwisiswant0
dwisiswant0 requested a review from Mzack9999 October 7, 2026 13:48
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 65479bd4-b515-48b4-8ee4-920a9217b8b2
📥 Commits

Reviewing files that changed from the base of the PR and between 43f474d and f43053f.

📒 Files selected for processing (1)
  • Dockerfile

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.


Walkthrough

The Dockerfile now uses Alpine 3.18.3 directly and copies a platform-specific prebuilt binary into /usr/local/bin/. It adds five OCI metadata labels. The package upgrade, installation of bind-tools and ca-certificates, and mapcidr entrypoint remain.

Changes

Docker image assembly

Layer / File(s) Summary
Assemble image from prebuilt binary
Dockerfile
The Dockerfile replaces its Go builder and release stages with a single Alpine image stage. It copies a binary from the $TARGETPLATFORM path, adds five OCI metadata labels, and retains package installation and the mapcidr entrypoint.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to f4305

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)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The Dockerfile evidence supports #881 and #882: it uses alpine:latest, installs runtime packages, and copies $TARGETPLATFORM/mapcidr without compiling source. The tracked files include `.github/wo… Provide reviewable evidence for .goreleaser.yml and .github/workflows/release.yml, or restore repository access, so the image publishing, static AMD64 build, ARM target, snapshot behavior, action versions, and archive configuration can …
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: publishing Docker images through GoReleaser.
Out of Scope Changes check ✅ Passed The available change summary and Dockerfile content show changes related to the linked objectives: the image now uses a release binary and includes OCI labels. No unrelated change is established by th…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Full details: Linked Issues check

Explanation

The Dockerfile evidence supports #881 and #882: it uses alpine:latest, installs runtime packages, and copies $TARGETPLATFORM/mapcidr without compiling source. The tracked files include .github/workflows/release.yml and do not include the old workflow paths. However, the whole-PR diff failed, and .goreleaser.yml could not be read. The available evidence does not verify dockers_v2, image tags, snapshot behavior, CGO_ENABLED=0, ARM paths, action updates, or the GoReleaser v2 configuration required by #881 and #883.

Resolution

Provide reviewable evidence for .goreleaser.yml and .github/workflows/release.yml, or restore repository access, so the image publishing, static AMD64 build, ARM target, snapshot behavior, action versions, and archive configuration can be verified.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

I’m a rabbit with a Dockerfile to greet,
A prebuilt mapcidr hops into its seat.
Alpine waits, labels shine bright,
bind-tools and certificates join the site.
The entrypoint points the way—
I nibble a carrot and hop away!

Comment @coderabbitai help to get the list of available commands.

@Mzack9999 Mzack9999 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dwisiswant0
dwisiswant0 merged commit 9fbcd14 into main Oct 8, 2026
3 checks passed
@dwisiswant0
dwisiswant0 deleted the dwisiswant0/build/publish-docker-images-with-goreleaser branch October 8, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants