Skip to content

Commit 5034479

Browse files
committed
ci: publish multi-arch images to ghcr.io
goreleaser's dockers_v2 assembles the manifest from the binaries it already built, so the image is a COPY of a static binary and the repo keeps one version-stamping path. The final stage runs nothing: a RUN would need QEMU to execute a non-native arch under buildx, so the cert bundle is copied out of a BUILDPLATFORM stage instead. Alpine over distroless keeps a shell, which the image needs to serve as a CI job image. Beta releases take :latest — nothing stabler is published yet. beep boop
1 parent 513c2fc commit 5034479

4 files changed

Lines changed: 48 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
permissions:
1414
contents: write # upload release artifacts
15+
packages: write # push to ghcr.io
1516
id-token: write # attest artifacts
1617
attestations: write
1718
steps:
@@ -22,6 +23,12 @@ jobs:
2223
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
2324
with:
2425
go-version-file: go.mod
26+
- uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
27+
- uses: docker/login-action@371161bbe7024a29a25c5e19bfcbc0804fe9ad2c # v4.5.2
28+
with:
29+
registry: ghcr.io
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
2532
- uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3
2633
with:
2734
version: "~> v2"
@@ -32,3 +39,6 @@ jobs:
3239
- uses: actions/attest@508db95dd578ae2727ebd6217d5ba78e4fbda05d # v4.2.1
3340
with:
3441
subject-checksums: ./dist/checksums.txt
42+
- uses: actions/attest@508db95dd578ae2727ebd6217d5ba78e4fbda05d # v4.2.1
43+
with:
44+
subject-checksums: ./dist/digests.txt

.goreleaser.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,27 @@ archives:
3434
checksum:
3535
name_template: checksums.txt
3636

37+
docker_digest:
38+
name_template: digests.txt
39+
40+
dockers_v2:
41+
- images:
42+
- ghcr.io/flagsmith/flagsmith-cli
43+
tags:
44+
- "{{ .Tag }}"
45+
- "{{ .Version }}"
46+
# Beta releases still take :latest — nothing stabler is published yet.
47+
- latest
48+
platforms:
49+
- linux/amd64
50+
- linux/arm64
51+
labels:
52+
# Links the ghcr package to this repo.
53+
org.opencontainers.image.source: https://github.com/Flagsmith/flagsmith-cli
54+
org.opencontainers.image.version: "{{ .Tag }}"
55+
org.opencontainers.image.revision: "{{ .FullCommit }}"
56+
org.opencontainers.image.licenses: MIT
57+
3758
# changelog handled by release-please.
3859
changelog:
3960
disable: true

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM --platform=$BUILDPLATFORM alpine:3 AS certs
2+
RUN apk add --no-cache ca-certificates
3+
4+
FROM alpine:3
5+
ARG TARGETPLATFORM
6+
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
7+
COPY $TARGETPLATFORM/flagsmith /usr/local/bin/flagsmith
8+
WORKDIR /work
9+
ENTRYPOINT ["flagsmith"]

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ The next-generation Flagsmith command-line interface (work in progress).
88
go build -o flagsmith .
99
```
1010

11+
## Docker
12+
13+
```sh
14+
docker run --rm -v "$PWD:/work" -e FLAGSMITH_API_KEY ghcr.io/flagsmith/flagsmith-cli flag list
15+
```
16+
17+
A container has no keyring, so `flagsmith login` cannot store credentials there — pass `FLAGSMITH_API_KEY` or `FLAGSMITH_ENVIRONMENT_KEY`.
18+
1119
## Quickstart
1220

1321
```sh

0 commit comments

Comments
 (0)