Skip to content

fix: publish distroless Docker image with GoReleaser v2#716

Open
Siddhant-K-code wants to merge 1 commit into
openfga:mainfrom
Siddhant-K-code:fix/distroless-dockers-v2
Open

fix: publish distroless Docker image with GoReleaser v2#716
Siddhant-K-code wants to merge 1 commit into
openfga:mainfrom
Siddhant-K-code:fix/distroless-dockers-v2

Conversation

@Siddhant-K-code

@Siddhant-K-code Siddhant-K-code commented Jun 28, 2026

Copy link
Copy Markdown
Member

Summary

  • Move the Docker image from scratch to distroless static nonroot so CA certificates are present for HTTPS endpoints.
  • Replace per-arch dockers + docker_manifests with dockers_v2, keeping buildx provenance enabled instead of disabling it.
  • Update release digest extraction for dockers_v2 Docker Image artifacts.

Docs

  • README Docker section now documents that the published image is multi-platform and includes CA certificates.

Validation

  • PATH=/tmp/go1.26.4/bin:$PATH make build
  • PATH=/tmp/go1.26.4/bin:$PATH go test ./...
  • PATH=/tmp/go1.26.4/bin:$PATH make test-unit
  • PATH=/tmp/syft-bin:/tmp/go1.26.4/bin:$PATH /tmp/goreleaser-bin/goreleaser release --clean --config .goreleaser.yaml --snapshot --skip sign,publish,announce,docker
  • Focused dockers_v2 pipeline validation with a fake Docker shim: /tmp/goreleaser-bin/goreleaser release --clean --config .goreleaser.yaml --snapshot --skip sign,publish,announce,archive,nfpm,homebrew,aur,sbom

Reviewer with Docker can additionally run: goreleaser release --clean --config .goreleaser.yaml --snapshot --skip sign,publish,announce.

Fixes #639

Summary by CodeRabbit

  • New Features

    • Added multi-platform Docker images for the CLI, with support for both amd64 and arm64.
    • Updated Docker image builds to use a non-root base image and include CA certificates for HTTPS connections.
  • Bug Fixes

    • Improved release digest selection to target the correct image artifact for each platform.
  • Documentation

    • Clarified Docker installation notes to mention multi-platform support and built-in CA certificates.

Copilot AI review requested due to automatic review settings June 28, 2026 04:57
@Siddhant-K-code Siddhant-K-code requested review from a team as code owners June 28, 2026 04:57
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bd99de84-6adb-439c-add3-7d14414852ed

📥 Commits

Reviewing files that changed from the base of the PR and between 861efd9 and c365b63.

📒 Files selected for processing (4)
  • .github/workflows/main.yaml
  • .goreleaser.Dockerfile
  • .goreleaser.yaml
  • README.md

Walkthrough

Switches the Docker base image from scratch to gcr.io/distroless/static-debian13:nonroot, adopts GoReleaser's dockers_v2 for native multi-platform builds (linux/amd64, linux/arm64), updates the CI digest step to select the new artifact type, and adds a README note about CA certificates.

Changes

Distroless Multi-Platform Docker Migration

Layer / File(s) Summary
Dockerfile and GoReleaser multi-platform config
.goreleaser.Dockerfile, .goreleaser.yaml
Dockerfile switches from scratch to gcr.io/distroless/static-debian13:nonroot, adds ARG TARGETPLATFORM, and copies the binary from ${TARGETPLATFORM}/fga. GoReleaser replaces the dockers + docker_manifests blocks with a single dockers_v2 block targeting both platforms, with unified OCI-labeled tags.
CI image digest step
.github/workflows/main.yaml
Updates the "Image digest" step to select a Docker Image artifact matching openfga/cli:${GITHUB_REF_NAME} with both linux/amd64 and linux/arm64 platforms, and parses the image name from the artifact's .path field via jq.
README Docker section
README.md
Adds a note that the Docker image is multi-platform and includes CA certificates for HTTPS connections to OpenFGA endpoints.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • SoulPancake
  • curfew-marathon
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: switching Docker image publishing to a distroless setup with GoReleaser v2.
Linked Issues check ✅ Passed The PR addresses the issue by replacing scratch with distroless, preserving multi-platform GoReleaser publishing, and keeping the release flow stable.
Out of Scope Changes check ✅ Passed The changes stay within scope: Docker image base, GoReleaser config, digest extraction, and related docs for the publishing flow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the release pipeline to publish a multi-platform Docker image based on a distroless (static, nonroot) base so that CA certificates are present at runtime, fixing TLS failures when the CLI runs in Docker and connects to HTTPS endpoints.

Changes:

  • Switch .goreleaser.Dockerfile from scratch to distroless static nonroot and adjust the binary copy path.
  • Replace per-arch dockers + docker_manifests with a single multi-platform dockers_v2 configuration in GoReleaser v2.
  • Update the GitHub Actions workflow logic that extracts/publishes the released image digest from GoReleaser artifacts, and document the CA cert behavior in the README.

Reviewed changes

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

File Description
README.md Documents the Docker image’s multi-platform nature and CA certificate availability.
.goreleaser.yaml Migrates Docker publishing configuration to dockers_v2 for multi-platform builds.
.goreleaser.Dockerfile Moves the runtime base image to distroless static nonroot and updates how the binary is copied in.
.github/workflows/main.yaml Adjusts digest extraction to match dockers_v2 “Docker Image” artifacts for provenance/verification steps.

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

Comment thread README.md
docker pull openfga/cli; docker run -it openfga/cli
```

The Docker image is multi-platform and includes CA certificates, so CLI commands can connect to HTTPS OpenFGA endpoints without mounting a certificate bundle.
Comment thread .goreleaser.yaml
Comment on lines +31 to +34
- latest
- "{{ .Tag }}"
- "v{{ .Version }}"
- "v{{ .Major }}"
Comment on lines +233 to 234
image=$(echo "$artifact" | jq -r '.path | split(":")[0]')
digest=$(echo "$artifact" | jq -r '.extra.Digest')

@SoulPancake SoulPancake 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.

dockers_v2 is currently still experimental.
There will be a stable release with goreleaser v3 launch, so we probably shouldn't use it right now

@SoulPancake

Copy link
Copy Markdown
Member

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.

Move Docker image to distroless while preserving GoReleaser compatibility

3 participants