Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add docker publish #37

Merged
merged 1 commit into from
Oct 22, 2024
Merged
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
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"]