Mix release don't find erlexec

I’m created a release using mix release, with runtime.exs config and so on…
However, When I try to start the release:

/home/matthew/Documents/privy/teste_1help/_build/prod/rel/bank/releases/0.1.0/../../erts-11.1.1/bin/erl: line 12: /home/matthew/Documents/privy/teste_1help/_build/prod/rel/bank/erts-11.1.1/bin/erlexec: No such file or directory

I build the release two times:

1 - locally, using mix release directly
2 - using earthly, as:

release:
  FROM +setup-base

  ENV MIX_ENV=prod
  COPY mix.exs .
  COPY mix.lock .
  RUN mix local.rebar --force
  RUN mix local.hex --force
  RUN mix do deps.get, deps.compile
  COPY --dir config lib priv ./

  RUN mix release

  SAVE ARTIFACT ./_build/prod/rel AS LOCAL ./rel

setup-base:
   ARG ELIXIR=1.11.2
   ARG OTP=23.1.1
   FROM hexpm/elixir:$ELIXIR-erlang-$OTP-alpine-3.12.0
   RUN apk add --no-progress --update build-base
   ENV ELIXIR_ASSERT_TIMEOUT=10000
   WORKDIR /bank

What I could be doing wrongly?

As far as I understand earthly, the SAVE ARTIFACT saves the binary artifact locally as ./rel in your case.

A requirement on releases is that the build and runtime system needs to be compatible. And compatibility means that they need to have the same CPU architecture, C stdlib and others.

As a rule of thumb, use the same operating system with roughly the same update state.

So unless you are running alpine, you can not run that release on your system.

Either create a docker image containing your release that is alpine as well, or use a build container that is matching your OS.

1 Like

Hi, I work on earthly.

Noobz is right. You will need to build an artifact for your host architecture and any dynamic linking could be an issue.

For the first of those issues, we do have an experimental multi-platform build feature:
https://docs.earthly.dev/guides/multi-platform

This feature is using the multi-platform features of buildkit:

For the second, that is trickier, but we are planning to have better support for local development workflows in the future.

3 Likes

Wow! I’, so excited about this project! Thanks for the reply!

1 Like