Leverage multi-architecture support on image build #312
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Leverage architecture on build context
Considering the ubiquity of ARM64, now in Macbooks with M1 and M2, and future computers with Windows on ARM (10/11), having multiarch support is a must-have in the developer toolbelt. As an owner of the M1 MacBook Pro, I really feel the difference in performance when using a linux/arm64 based image. Especially with the latest Docker for Mac version.
In the cloud side, cheaper instances with ARM64 architecture are popping out all over the place, like the Amazon EC2 A1, for example.
I do use TheCodingMachine's project a lot, and I'm a great supporter for the project. I used to use it a lot in Brazil in many companies I worked for. Likewise, I decided to implement and test multiarch support.
I've tested all the versions on an ARM64 VM with Linux and Docker installed (With UTM, a very good QEMU GUI for M1 Mac) and all the images passed the test.
I've been using the linux/arm64 version of this image to work for more than a month and I could not find a single misbehavior.
Basically, the main change is that the binaries that were statically being pulled in an AMD64 version (like SuperCronic, Tini, or Blackfire) now use variables given by buildkit to determine which OS and Arch is being used and pulls the proper binary for the target OS.
This PR fixes/implements :
Test plan (required)
Have an ARM64 VM or configure buildkit to be able to build for ARM64.
Checklist