Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,16 @@ jobs:
ARTIFACTS: "${{ steps.goreleaser.outputs.artifacts }}"
run: |
set -euo pipefail
artifact=$(echo "$ARTIFACTS" | jq -r '[.[] | select (.type=="Docker Manifest")][0]')
image=$(echo "$artifact" | jq -r '.path' | cut -d':' -f1)
artifact=$(
echo "$ARTIFACTS" | jq -er --arg image_tag "openfga/cli:${GITHUB_REF_NAME}" '
[
.[]
| select(.type == "Docker Image")
| select(.path == $image_tag)
| select(((.extra.Platforms // []) | index("linux/amd64")) and ((.extra.Platforms // []) | index("linux/arm64")))
][0]
'
)
digest=$(echo "$artifact" | jq -r '.extra.Digest')
echo "digest=$digest" >> "$GITHUB_OUTPUT"

Expand Down
8 changes: 5 additions & 3 deletions .goreleaser.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
FROM scratch
COPY fga /fga
ENTRYPOINT ["/fga"]
FROM gcr.io/distroless/static-debian13:nonroot

ARG TARGETPLATFORM
COPY ${TARGETPLATFORM}/fga /fga
ENTRYPOINT ["/fga"]
77 changes: 17 additions & 60 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,68 +24,25 @@ builds:
- "-X github.com/openfga/cli/internal/build.Commit={{.Commit}}"
- "-X github.com/openfga/cli/internal/build.Date={{.Date}}"

dockers:
- goos: linux
goarch: amd64

dockers_v2:
- images:
- openfga/cli
tags:
- latest
- "{{ .Tag }}"
- "v{{ .Major }}"
- "v{{ .Major }}.{{ .Minor }}"
dockerfile: .goreleaser.Dockerfile

image_templates:
- "openfga/cli:latest-amd64"
- "openfga/cli:{{ .Tag }}-amd64"
- "openfga/cli:v{{ .Version }}-amd64"
- "openfga/cli:v{{ .Major }}-amd64"
- "openfga/cli:v{{ .Major }}.{{ .Minor }}-amd64"
- "openfga/cli:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}-amd64"

use: buildx
build_flag_templates:
- "--platform=linux/amd64"
platforms:
- linux/amd64
- linux/arm64
labels:
org.opencontainers.image.created: "{{ .Date }}"
org.opencontainers.image.title: "{{ .ProjectName }}"
org.opencontainers.image.revision: "{{ .FullCommit }}"
org.opencontainers.image.version: "{{ .Version }}"
flags:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"

- goos: linux
goarch: arm64

dockerfile: .goreleaser.Dockerfile

image_templates:
- "openfga/cli:latest-arm64"
- "openfga/cli:{{ .Tag }}-arm64"
- "openfga/cli:v{{ .Version }}-arm64"
- "openfga/cli:v{{ .Major }}-arm64"
- "openfga/cli:v{{ .Major }}.{{ .Minor }}-arm64"
- "openfga/cli:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}-arm64"

use: buildx

build_flag_templates:
- "--platform=linux/arm64"

docker_manifests:
- name_template: openfga/cli:latest
image_templates:
- openfga/cli:latest-amd64
- openfga/cli:latest-arm64
- name_template: openfga/cli:v{{ .Version }}
image_templates:
- openfga/cli:v{{ .Version }}-amd64
- openfga/cli:v{{ .Version }}-arm64
- name_template: openfga/cli:v{{ .Major }}
image_templates:
- openfga/cli:v{{ .Major }}-amd64
- openfga/cli:v{{ .Major }}-arm64
- name_template: openfga/cli:v{{ .Major }}.{{ .Minor }}
image_templates:
- openfga/cli:v{{ .Major }}.{{ .Minor }}-amd64
- openfga/cli:v{{ .Major }}.{{ .Minor }}-arm64
- name_template: openfga/cli:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}
image_templates:
- openfga/cli:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}-amd64
- openfga/cli:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}-arm64

release:
draft: true
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ scoop install openfga
docker pull openfga/cli; docker run -it openfga/cli
```

The Docker image is multi-platform and includes the system CA certificates needed for endpoints that use publicly trusted certificate authorities. Private or internal CAs still need to be provided by the user.

### Go

```shell
Expand Down
Loading