Skip to content

Improve Docker: use GoReleaser for images#584

Open
jpillora wants to merge 2 commits intomasterfrom
improved-docker
Open

Improve Docker: use GoReleaser for images#584
jpillora wants to merge 2 commits intomasterfrom
improved-docker

Conversation

@jpillora
Copy link
Copy Markdown
Owner

@jpillora jpillora commented Apr 4, 2026

Summary

  • Merge release_binaries and release_docker into a single release job powered by GoReleaser
  • Publish multi-arch Docker images (amd64, arm64, armv7, armv6, 386, ppc64le) to both GHCR and Docker Hub
  • Simplify Dockerfile to use GoReleaser's pre-built binary instead of rebuilding from source
  • Scope workflow permissions properly (contents:write, packages:write)

Test plan

  • CI tests pass on all 3 platforms (ubuntu, macOS, Windows)
  • goreleaser check validates config
  • Release job correctly skipped (no tag)
  • Tag a release to verify full end-to-end Docker + binary publishing

🤖 Generated with Claude Code

- Replace separate docker/build-push-action job with GoReleaser dockers
- Merge release_binaries and release_docker into single release job
- Publish multi-arch images to both GHCR and Docker Hub
- Simplify Dockerfile to use pre-built binary from GoReleaser
- Scope permissions properly (contents:write, packages:write)
- Architectures: amd64, arm64, armv7, armv6, 386, ppc64le

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 4, 2026 10:51
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR consolidates the project’s release workflow so GoReleaser becomes the single source of truth for building binaries/packages and publishing multi-arch Docker images to GHCR and Docker Hub.

Changes:

  • Merge the separate binary + Docker release jobs into one release job powered by GoReleaser.
  • Add GoReleaser configuration to build/push per-arch Docker images and multi-arch manifests.
  • Simplify the Dockerfile to package the prebuilt GoReleaser binary instead of building from source.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
.github/workflows/ci.yml Replaces prior release jobs with a single GoReleaser-driven release job and scopes job permissions.
.github/goreleaser.yml Adds Docker/buildx and manifest publishing configuration for multiple architectures and registries.
.github/Dockerfile Switches to a minimal scratch image that copies in the GoReleaser-produced binary and CA certs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

cache-from: type=gha
cache-to: type=gha,mode=max
distribution: goreleaser
version: latest
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

Using version: latest for GoReleaser makes releases non-reproducible and can break unexpectedly when a new GoReleaser is published. Prefer pinning to a specific major/minor (or exact) GoReleaser version so tag builds remain stable over time.

Suggested change
version: latest
version: v2.12.7

Copilot uses AI. Check for mistakes.
Comment on lines +64 to +68
- image_templates:
- "ghcr.io/jpillora/chisel:{{ .Tag }}-amd64"
- "docker.io/jpillora/chisel:{{ .Tag }}-amd64"
use: buildx
dockerfile: .github/Dockerfile
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

Docker image tags/manifests are templated with {{ .Tag }}, which will include the leading v from git tags (e.g., v1.2.3). This differs from the prior workflow’s semver tags (e.g., 1.2.3) and from the binary BuildVersion which uses {{ .Version }}. If you want to preserve existing Docker tag semantics, switch these templates to use {{ .Version }} (and update all related templates consistently).

Copilot uses AI. Check for mistakes.
Comment on lines +120 to +124
docker_manifests:
- name_template: "ghcr.io/jpillora/chisel:{{ .Tag }}"
image_templates:
- "ghcr.io/jpillora/chisel:{{ .Tag }}-amd64"
- "ghcr.io/jpillora/chisel:{{ .Tag }}-arm64"
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

The previous Docker publishing step generated additional semver tags (major/minor/major.minor) via docker/metadata-action. With the current docker_manifests config, only the full tag (and latest) are published. If downstream users rely on :1, :1.2, etc., consider adding corresponding manifest name_template entries for those aliases.

Copilot uses AI. Check for mistakes.
Comment on lines +130 to +137
- name_template: "ghcr.io/jpillora/chisel:latest"
image_templates:
- "ghcr.io/jpillora/chisel:{{ .Tag }}-amd64"
- "ghcr.io/jpillora/chisel:{{ .Tag }}-arm64"
- "ghcr.io/jpillora/chisel:{{ .Tag }}-armv7"
- "ghcr.io/jpillora/chisel:{{ .Tag }}-armv6"
- "ghcr.io/jpillora/chisel:{{ .Tag }}-386"
- "ghcr.io/jpillora/chisel:{{ .Tag }}-ppc64le"
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

This config will push/update the :latest multi-arch manifests on every version tag, including prereleases (since release.prerelease is auto). If you don’t want prereleases to move latest, consider removing these latest manifest entries or gating them so only stable tags publish latest.

Copilot uses AI. Check for mistakes.
Use .Version instead of .Tag for Docker image templates, add major and
major.minor manifest tags, skip pushing latest/semver tags for prereleases,
and pin GoReleaser to v2.12.7 for reproducible builds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants