Skip to content

Commit ca05a1e

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 c2c6b2c commit ca05a1e

4 files changed

Lines changed: 42 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 7 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
steps:
1617
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1718
with:
@@ -20,6 +21,12 @@ jobs:
2021
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
2122
with:
2223
go-version-file: go.mod
24+
- uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
25+
- uses: docker/login-action@371161bbe7024a29a25c5e19bfcbc0804fe9ad2c # v4.5.2
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
2330
- uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3
2431
with:
2532
version: "~> v2"

.goreleaser.yaml

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

37+
dockers_v2:
38+
- images:
39+
- ghcr.io/flagsmith/flagsmith-cli
40+
tags:
41+
- "{{ .Tag }}"
42+
- "{{ .Version }}"
43+
# Beta releases still take :latest — nothing stabler is published yet.
44+
- latest
45+
platforms:
46+
- linux/amd64
47+
- linux/arm64
48+
labels:
49+
# Links the ghcr package to this repo.
50+
org.opencontainers.image.source: https://github.com/Flagsmith/flagsmith-cli
51+
org.opencontainers.image.version: "{{ .Tag }}"
52+
org.opencontainers.image.revision: "{{ .FullCommit }}"
53+
org.opencontainers.image.licenses: MIT
54+
3755
# changelog handled by release-please.
3856
changelog:
3957
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)