I have a multi stage docker file and building the node assets works fine with both --platform linux/arm64 and linux/amd64. I can make the elixir/erlang image work with --platform linux/arm64, but when I try linux/amd64 qemu blows up:
FROM --platform=linux/amd64 hexpm/elixir:1.12.3-erlang-24.1.5-ubuntu-focal-20210325 AS deps
ARG MIX_ENV=prod
ARG HEX_MIRROR_URL=https://repo.hex.pm
RUN /usr/local/bin/mix local.hex --force && \
/usr/local/bin/mix local.rebar --force
RUN apt-get -qq update && apt-get install -y \
git \
unzip \
build-essential \
wget \
sudo
WORKDIR /opt/app
COPY config/ ./config
COPY mix.exs mix.lock /opt/app/
RUN mix deps.get --only $MIX_ENV
Some more digging here. It’s not OTP24 that fails, it is OTP24 on some distros:
OTP24 on Ubuntu Focal FAILS (hexpm/elixir:1.13.0-rc.1-erlang-24.1.5-ubuntu-focal-20210325)
OTP24 on Ubuntu Bionic FAILS (hexpm/elixir:1.13.0-rc.1-erlang-24.1.5-ubuntu-bionic-20210325)
OTP24 on Ubuntu Xenial WORKS (hexpm/elixir:1.13.0-rc.1-erlang-24.1.5-ubuntu-xenial-20210114)
OTP24 on Debian Stretch WORKS (hexpm/elixir:1.13.0-rc.1-erlang-24.1.5-debian-stretch-20210902)
OTP24 on Debian Bullseye FAILS (hexpm/elixir:1.13.0-rc.1-erlang-24.1.5-debian-bullseye-20210902)
OTP24 on Alpine 3.14.2 FAILS (hexpm/elixir:1.13.0-rc.1-erlang-24.1.5-alpine-3.14.2)
The crash happens when JIT is enabled. Disabling the JIT, using pre-JIT Erlang (23.x or older), or using an old OS that doesn’t have a version of gcc recent enough to support C++17 (required to compile the JIT) will work around it.
Aha! Thank you for clearing this up. Is this something that will never work due to compatibility issues you think, or is it possible, but a bug with qemu?
I’ve had the same issue today and trying with the Ubuntu image of Elixir 1.13 and OTP 25 worked for arm64 using QEMU using Github Actions. (image name: elixir:1.13.4-erlang-25.0.4-ubuntu-xenial-20210804)
I also ran into this issue trying to build for linux/amd64 from an apple silicon macbook. I’m using mix phx.gen.release --docker and wanting to using Elixir 1.14 and OTP 25.
I managed to get it to work with ubuntu:xenial-20210804 which is quite old, released in 2016.