-
Notifications
You must be signed in to change notification settings - Fork 212
Use native runners to build Docker images #374
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
Use native runners to build Docker images #374
Conversation
.github/workflows/release.yml
Outdated
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| registry: ${{ fromJSON(github.repository_owner == 'hyperledger' && '["docker.io", "ghcr.io"]' || '["ghcr.io"]') }} |
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.
In the Fabric release action, I did a dynamic matrix for the registry like this. But I did it for both the metadata job and the docker build job, and I kept digests for each registry in the temp directory. This PR uses the dynamic matrix for the metadata job only. I guess it is acceptable to do a single docker build job with outputs for each registry? The digest will be the same for both registries? Just want to make sure you have tested this for both registries. If this checks out that is good, I will modify the Fabric release job to behave the same to avoid the duplicate builds.
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.
I am so glad you queried this. I tested it but only with the GHCR publish because of the guards for hyperledger as the repository owner. I took out the guards and tried publishing to both GHCR and Docker Hub, and saw a parse error on the image name. I have now quoted the image name parameter and simultaneous publishing to both GHCR and Docker Hub works. I left it without guards to force future testing to include both.
The digests of the amd64 and arm64 images are identical in both GHCR and Docker Hub. I think with the image epoch generated from the commit timestamp you should be able to produce images with the same hash over multiple builds anyway. This approach just means each image is only built once before being pushed to both registries.
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.
ok, good to know! I'll look at a similar update for fabric repository.
I didn't quite get "I left it without guards to force future testing to include both." Could you clarify what you mean? What is the best way to test in the future?
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.
The current change publishes to both GHCR and Docker Hub. There is no guard to only publish to Docker Hub if the repo owner is hyperledger so the behaviour is the same for forks and the main repo. For example, this run on my fork
e701798 to
7ba91c8
Compare
Instead of relying on QEMU emulation to build multi-arch images, use native arm64 and amd64 build runners to build architecture-specific images, then publish multi-arch metadata with each of the image manifests. Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
7ba91c8 to
58cd356
Compare
|
denyeart
left a comment
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.
Thanks for explaining Mark!



Instead of relying on QEMU emulation to build multi-arch images, use native arm64 and amd64 build runners to build architecture-specific images, then publish multi-arch metadata with each of the image manifests.