-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Support multi-arch Docker images #521
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
Conversation
.github/workflows/docker.yaml
Outdated
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dhui In order for GitHub Actions to build and push the image automatically to Docker Hub, please add DOCKERHUB_USERNAME
and DOCKERHUB_TOKEN
into the repository secrets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgive my ignorance, but I thought docker images would run on different CPU architectures. Is this just an optimization?
Would support for multiple architectures make the images larger? It looks like it won't make larger images and just allows multiple images to be associated with the same tag.
@dhui No, docker images would not run on different CPU architectures unless the image itself support multi-architecture. Take the golang image for example, if you do Currently migrate/migrate only supports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use CircleCI. Artifacts aren't produced by CircleCI yet... See: #252
There is a blog on CircleCI's website explaining how to build multi-arch Docker images on CircleCI. I find it too cumbersome that we have to install Buildx manually and run On the other hand, Docker provides QEMU (docker/setup-qemu-action) and Buildx (docker/setup-buildx-action) integration into GitHub Actions. We don't need to reinvent the wheel and worry about the configuration at all. May I know why we can't use GitHub Actions? It is free for public repositories |
CircleCI provides many more credits for open source projects compared to other providers, which allows us to run tests for PRs. The 2k minutes Github Actions provides would be exhausted after a measly 25 runs... (each build takes ~40m and we build for 2 Go versions, so that's ~80m per run) |
The 2k minutes only count for private repositories. GitHub Actions is free for public repositories. |
Have you used over 2k Github Actions minutes on any of your public repos? The language isn't clear to me. e.g. free != unlimited If you've confirmed that Github Actions usage is unlimited for public repos, would you be willing to migrate our build system to Github Actions? e.g. linter, tests (needs to spin up docker images), PR checks, code coverage, and artifact uploads (docker, package cloud, & github releases) |
Here is the GitHub Actions job logs that run in one of my public repository: docker-multiarch/docker-buildx. The job used 1 minutes and 9 seconds in total. Looking into the organization Billing settings, as shown in the image below, the "1 minutes and 9 seconds" was not counted towards the 2k minutes quota. I know the documentation is a little bit of confusing. But I can be sure that the GitHub Actions usage is free and unlimited for public repositories as I have seen many public repositories using it, to name a few
Sure, I can help with that |
@dhui I have migrated from Circle CI to GitHub Actions. This includes:
EDIT: The checks are failing because I have removed all CircleCI related files. |
- name: Login to Docker Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dhui You will need to add the username and personal access token of the Dockerhub account that will be used to push the image as secrets. See https://docs.github.com/en/actions/reference/encrypted-secrets
See also this PR, which uses GoReleaser with Docker's buildx. Also, I think there is a 2K minute limit with GitHub Actions. I'm not sure if golangci-lint pays for more minutes, but their actions/tests take a lot less time to run than ours do. e.g. they're not running integration tests with a bunch of different DBs |
@dhui The quota only counts for private repositories. |
Signed-off-by: Eng Zer Jun <[email protected]>
This commit also uses GitHub Actions to build and push multi-architecture Docker image to Dockerhub. Signed-off-by: Eng Zer Jun <[email protected]>
Currently the migrate/migrate Docker image only supports
linux/amd64
OS/Arch.This pull request adds support for multi CPU-architectures by using Docker Buildx to build the images.
@dhui In addition, I have also added the GitHub Actions configuration for building and pushing the multi-arch images automatically on new tags. You will need to add your Docker Hub's username and personal access token into the repository secrets (see Action Secrets documentation).
Reference: docker/setup-qemu-action for the list of supported platforms