Skip to content

build: publish Docker images with GoReleaser - #768

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

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

Conversation

@dwisiswant0

Copy link
Copy Markdown
Member

Proposed changes

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 proxify. It copies $TARGETPLATFORM/proxify 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 on all three builds, so that the linux/amd64 binaries are static and run on Alpine. The linux/amd64 archive gets the same static binaries. The image still contains only proxify.

Copying the GoReleaser binary also fixes the image build. The old Dockerfile compiled with golang:1.24.0-alpine, which cannot build a module that requires Go 1.25.0.

Add version: 2 and replace the deprecated archives format key with formats; goreleaser check flagged both. Archive names do not change.

Supersedes #760.

Closes #766
Fixes #767

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

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 proxify. It
copies $TARGETPLATFORM/proxify 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 on all three builds, so that the linux/amd64 binaries
are static and run on Alpine. The linux/amd64 archive gets the same
static binaries. The image still contains only proxify.

Copying the GoReleaser binary also fixes the image build. The old
Dockerfile compiled with golang:1.24.0-alpine, which cannot build a
module that requires Go 1.25.0.

Add version: 2 and replace the deprecated archives format key with
formats; goreleaser check flagged both. Archive names do not change.

Closes #766
Fixes #767

Signed-off-by: Dwi Siswanto <git@dw1.io>

@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 03c4f4f into dev Oct 8, 2026
1 check passed
@dwisiswant0
dwisiswant0 deleted the dwisiswant0/build/publish-docker-images-with-goreleaser branch October 8, 2026 09:49
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.

Docker image build fails: Dockerfile uses golang:1.24.0-alpine, but go.mod requires Go 1.25.0 Publish Docker images with GoReleaser

2 participants