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

feat: deploy a multi-arch docker image #474

Merged
merged 7 commits into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
11 changes: 10 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,21 @@ jobs:
uses: percona-platform/setup-go@v2
with:
go-version: 1.17
-
-
name: Login to Docker Hub
uses: percona-platform/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

-
name: Login to GitHub Container Registry
uses: percona-platform/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

-
name: Run GoReleaser
uses: percona-platform/goreleaser-action@v2
Expand Down
41 changes: 39 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,47 @@ dockers:
- goos: linux
goarch: amd64
image_templates:
- "percona/mongodb_exporter:{{.Major}}.{{.Minor}}"
- "percona/mongodb_exporter:{{.Version}}"
- "docker.io/percona/mongodb_exporter:{{.Major}}.{{.Minor}}-amd64"
- "docker.io/percona/mongodb_exporter:{{.Version}}-amd64"
- "ghcr.io/percona/mongodb_exporter:{{.Major}}.{{.Minor}}-amd64"
- "ghcr.io/percona/mongodb_exporter:{{.Version}}-amd64"
dockerfile: Dockerfile
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- goos: linux
goarch: arm64
image_templates:
- "docker.io/percona/mongodb_exporter:{{.Major}}.{{.Minor}}-arm64v8"
- "docker.io/percona/mongodb_exporter:{{.Version}}-arm64v8"
- "ghcr.io/percona/mongodb_exporter:{{.Major}}.{{.Minor}}-arm64v8"
- "ghcr.io/percona/mongodb_exporter:{{.Version}}-arm64v8"
dockerfile: Dockerfile
use: buildx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikita-b / @BupycHuk Do we need to use buildx for our Docker builds?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We build this image only for the community and I think it's okey to use buildx :)

build_flag_templates:
- "--pull"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikita-b / @BupycHuk Do we need pull?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what does it here, but probably it pulls the latest version of the image to not use the one in a cache. So I think it's ok.
@nikita-b your thoughts

- "--platform=linux/arm64/v8"
docker_manifests:
## Docker Hub
- name_template: docker.io/percona/mongodb_exporter:{{.Major}}.{{.Minor}}
image_templates:
- docker.io/percona/mongodb_exporter:{{.Major}}.{{.Minor}}-arm64v8
- docker.io/percona/mongodb_exporter:{{.Major}}.{{.Minor}}-amd64

- name_template: docker.io/percona/mongodb_exporter:{{.Version}}
image_templates:
- docker.io/percona/mongodb_exporter:{{.Version}}-arm64v8
- docker.io/percona/mongodb_exporter:{{.Version}}-amd64
## GHCR
- name_template: ghcr.io/percona/mongodb_exporter:{{.Major}}.{{.Minor}}
image_templates:
- ghcr.io/percona/mongodb_exporter:{{.Major}}.{{.Minor}}-arm64v8
- ghcr.io/percona/mongodb_exporter:{{.Major}}.{{.Minor}}-amd64

- name_template: ghcr.io/percona/mongodb_exporter:{{.Version}}
image_templates:
- ghcr.io/percona/mongodb_exporter:{{.Version}}-arm64v8
- ghcr.io/percona/mongodb_exporter:{{.Version}}-amd64
nfpms:
- file_name_template: "{{ .ProjectName }}-{{ .Version }}.{{ .Os }}-{{ .Arch }}"
homepage: https://www.percona.com/
Expand Down