Closed andersonpem closed 2 years ago
Gotta tell you, Orbit is great to generate dockerfiles. I'll definitely use this in my projects.
I managed to pass the entire process on a Mac. I had to comment out some tests that misbehave in terms of permissions on a Mac. Probably because of filesystem differences.
Now that I know the images are build-able, I'll get back to my Linux x64 machine and run the build process with all the tests with ARM64 emulation.
It was taking forever to build on an emulation layer, so debugging was a pain.
Although Docker Buildx allows mullti-architecture builds and multi-architecture manifest push to the registry, it cannot export a multi-architecture build manifest to the local machine for testing, at least for the time being. (This considers using a container as a builder and using the --load parameter to get the image back to the host docker image list, which is necessary to build the other test images like the test/slim_onbuild) For testing, in the build and test script, one can only test the images in the current architecture, or asking for a build in other single architecture and setting up Qemu to run emulated architectures, which is a pain in the ass for some reason on my Ubuntu installation. I'll test the ARM images on an Ubuntu running in an Amazon ARM instance.
The UTM project came to my knowledge. Now I can spin an ARM64 Debian on my M1 Mac and perform the tests properly.
UTM allows you to run ARM64, AMD64 and even SPARC on the Mac M1. And they have a lot of pre-made recipes.
My Debian is a beast! Never saw a debian so snappy.
https://mac.getutm.app/gallery/
Pro-tip: update the linux kernel for full-screen support.
I'll be able to run the test suite properly now. Linux/arm64 on actual linux/arm64 on an actual ARM CPU.
All the tests passed in Debian running on ARM64. Except one: run Blackfire. However, the current Blackfire implementation prevents it from having an ARM version. I'll refactor this portion of the code and maybe I can put in Blackfire v2 support too.
The suggestion in this pull request is very practical. I'll hardcode a v1 method for getting theblackfire client for now. https://github.com/thecodingmachine/docker-images-php/pull/308
PR is available if somebody wants to build this locally for testing or for using urgently: https://github.com/thecodingmachine/docker-images-php/pull/312
I made a mistake in variable naming in the Dockerfile according to Buildkit's specification. Working on it. Testing again.
Leverage architecture on build process
As Apple Silicon (ARM64/v8) becomes more ubiquitous, and companies like Amazon have instances that are cheaper using the ARM architecture, an ARM64 build of this image is very interesting to have.
As a now Mac / Linux user, I feel the performance loss of not using native ARM packages when running containers from this project.
Also: Tini misbehaves when using the AMD64 platform version on Apple Silicon.
Currently, the only architecture on thecodingmachine's Docker Hub repository is amd64
Sury (The Debian repository we get packages for PHP) has ARM64 packages. I've tested building it.
I'm working on a version of the build scripts that leverage the architecture being built to select packages like tini and supercronic for the proper architecture.
I'll update this issue as I get deeper into this.