christo-ph
Release docker & build, NIF for wx not found
After generating a Dockerfile with mix release, and build it with docker build, I am unable to start elixir in the container:
=INFO REPORT==== 15-Dec-2023::08:20:17.080211 ===
application: kernel
exited: {{shutdown,
{failed_to_start_child,on_load,
{on_load_function_failed,gl,
{error,
{load_failed,
"Failed to load NIF library: '/app/lib/wx-2.3.1/priv/erl_gl.so: cannot open shared object file: No such file or directory'"}}}}},
{kernel,start,[normal,[]]}}
type: permanent
I am using the generated Dockerfile as is with the following versions:
ARG ELIXIR_VERSION=1.15.7
ARG OTP_VERSION=26.1.2
ARG DEBIAN_VERSION=bullseye-20231009-slim
ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"
What is missing here? build and execution on Apple Silicon
Most Liked
D4no0
For future reference, these applications are part of OTP and are bundled together with erlang runtime, if declared of course.
In earlier versions of elixir, all packages would be usually bundled without having to specifically add them, this changed in version 1.15 (or maybe earlier), now you have to specifically declare them if you want to bundle them with your release.
On the dev side, the libraries will work without adding extra_applications as long as your local erlang installation compiled all of them.
D4no0
The behavior you are encountering above might be subject to a potential bug, if either your app or a library has extra_applications defined, the OTP libraries should be bundled with release. I misread before, thinking that you are using those libraries from your own application.
A simple example would be the fact that phoenix uses crypto, which is an OTP library, and you don’t have to declare it in your actual application.
rhblind
Yes, that was it! I’ve spent all day researching this ![]()
Thank you very much!!
![]()
![]()
harrisi
Always happy to be someone’s rubber duck. ![]()







