-
Notifications
You must be signed in to change notification settings - Fork 0
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: docker multi arch images #13
Conversation
Following the docker guide on buildling images for multiple architectures, we need to setup buildx first. The blog article mentions a custom github action that is no longer maintaned. However, it references official docker github actions that are we can use to setup buildx. References - Docker guide: https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/ - GH Action Custom Setup Buildx: https://github.com/crazy-max/ghaction-docker-buildx - GH Action Qemu: https://github.com/docker/setup-qemu-action - GH Action Buildx: https://github.com/docker/setup-buildx-action
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.
Testing the commands locally with the medical-dashboard resulted in three images:
The command i used was:
docker buildx build . -t ghcr.io/dot-base/medical-dashboard:test-review --push --platform linux/amd64,linux/arm64 --build-arg FONTAWESOME_NPM_AUTH_TOKEN=xxxx
I could reproduce this, now that I have the latest version of I think we have 2 alternatives:
What do you think? @Zbozi Related Issues:
|
We decided to not change it for now, as Github should fix it eventually. |
This closes #12.
We need to build our docker images for multiple architectures (
amd64
andarm64
) since we need to be able to develop on MacBooks based on Apple silicon (M1 etc.).This PR uses
docker buildx
to simply build multi arch images. Thedocker buildx build
also includes pushing the images to the registry (with--push
), so we can get rid of the separatedocker push
commands.In order to use
docker buildx
we need to setup it using thesetup-buildx-action
action.The github action mentioned in the docker guide is deprecated. However it mentions the correct docker gh actions that we can use:
How to test (locally)
I tested the
docker buildx
command locally on MacBook Pro with M2 chip creating a test image for the data graph repository:docker buildx build . -t ghcr.io/dot-base/data-graph:2023-06-28-test --push --platform linux/amd64,linux/arm64
Running the command above for the 1st time will result in an error, since we are missing the correct driver:
Therfore, we need to create a docker driver first:
If we run the
buildx
command again, it will work successfully.docker buildx build . -t ghcr.io/dot-base/data-graph:2023-06-28-test --push --platform linux/amd64,linux/arm64
It successfully creates an image for both architectures. See registry
Reference