Skip to content

Commit

Permalink
ci: add docker publish (#37)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Beemer <[email protected]>
  • Loading branch information
beeme1mr authored Oct 22, 2024
1 parent 7d619ad commit 4b329dc
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 3 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,30 @@ jobs:

go-release:
needs: release-please
if: ${{ fromJSON(needs.release-please.outputs.release_created) }}
runs-on: ubuntu-latest
permissions:
contents: write
if: ${{ fromJSON(needs.release-please.outputs.release_created) }}
packages: write
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ needs.release-please.outputs.release_tag_name }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Go
uses: actions/setup-go@v5
with:
Expand All @@ -52,9 +65,7 @@ jobs:
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: "~> v2"
args: release --clean
env:
Expand Down
38 changes: 38 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,41 @@ archives:
format: zip

report_sizes: true

dockers:
- image_templates: ["ghcr.io/open-feature/codegen:{{ .Version }}-amd64"]
dockerfile: Dockerfile
use: buildx
build_flag_templates:
- --platform=linux/amd64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/open-feature/codegen
- --label=org.opencontainers.image.source=https://github.com/open-feature/codegen
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=Apache-2.0

- image_templates: ["ghcr.io/open-feature/codegen:{{ .Version }}-arm64"]
goarch: arm64
dockerfile: Dockerfile
use: buildx
build_flag_templates:
- --platform=linux/arm64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/open-feature/codegen
- --label=org.opencontainers.image.source=https://github.com/open-feature/codegen
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=Apache-2.0

docker_manifests:
- name_template: ghcr.io/open-feature/codegen:{{ .Version }}
image_templates:
- ghcr.io/open-feature/codegen:{{ .Version }}-amd64
- ghcr.io/open-feature/codegen:{{ .Version }}-arm64
- name_template: ghcr.io/open-feature/codegen:latest
image_templates:
- ghcr.io/open-feature/codegen:{{ .Version }}-amd64
- ghcr.io/open-feature/codegen:{{ .Version }}-arm64
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
COPY openfeature .
USER 65532:65532

ENTRYPOINT ["/openfeature"]

0 comments on commit 4b329dc

Please sign in to comment.