alpine-elixir
alpine-elixir copied to clipboard
Enable qemu build for ARM64
Building image for platform arm64 (or multi-platform) on a amd64 computer (so, using qemu through buildkit) fails on make for elixir step, because -for some unknown reason to me- binaries (erl, escript, etc) are expected to be on /usr/local/sbin instead where they really are (/usr/local/bin).
#0 104.0 Recompile: src/elixir_bitstring
#0 105.0 Recompile: src/elixir_aliases
#0 105.3 Recompile: src/elixir
#0 106.2 Error while loading /usr/local/sbin/escript: No such file or directory
#0 106.2 make: *** [Makefile:102: lib/elixir/ebin/elixir.app] Error 1
With this workaround the image can be built for ARM64.
You can reproduce the issue by running "make build" on any amd64 computer, but I guess you already know it, since the GitHub action configured only builds and publish AMD64 version.
I'm unable to reproduce this on an x86_64 machine that I run my Docker builds on - the multi-arch build completes successfully without the patch, and that includes both the amd64 and arm64 images. I'm also skeptical of the fix here, as it is definitely not correct to symlink /usr/local/bin to /usr/local/sbin, it would be better to understand why your build is expecting to find Erlang tooling in that directory.
..since the GitHub action configured only builds and publish AMD64 version.
That's incorrect, the current GitHub Actions workflow builds both amd64 and arm64 images (it is a multi-arch build). I confirmed this by pulling the arm64 version of the latest bitwalker/alpine-elixir release, just to make sure.
Is there something else different about your environment? Have you changed the Dockerfile at all, or modified the VERSION file? I'm not sure what would cause the issue on your machine and not elsewhere, but I suspect it has to be environmental in some way.