Compile error while building alpine-elixir Dockerfile

Hi all I’m building the alpine-elixir Docker image at:

on a Digital Ocean Ubuntu 19.10 vps:
uname -a
Linux edge-faithful-word 5.3.0-42-generic #34-Ubuntu SMP Fri Feb 28 05:49:40 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

I simply cloned the repo and I build the image with:
docker build -t alpelixir .

and it will fail when compiling elixir in the Elixir.String.Unicode.beam module:

make[1]: Entering directory '/tmp/elixir-build/elixir'
==> unicode (compile)
make[1]: Leaving directory '/tmp/elixir-build/elixir'
make[1]: *** [Makefile:105: lib/elixir/ebin/Elixir.String.Unicode.beam] Killed
make: *** [Makefile:90: lib/elixir/ebin/Elixir.Kernel.beam] Error 2
The command '/bin/sh -c apk --no-cache --update upgrade &&     apk add --no-cache --update --virtual .elixir-build       make &&     apk add --no-cache --update       git &&     git clone --depth 1 --branch $ELIXIR_VERSION &&     cd elixir &&     make && make install &&     mix local.hex --force &&     mix local.rebar --force &&     cd $HOME &&     rm -rf /tmp/elixir-build &&     apk del --no-cache .elixir-build' returned a non-zero code: 2

This seems pretty odd to me as I would think this process is fairly battle-tested.

Any ideas on what may be the cause? Perhaps a missing dependency?

I should mention that I could build the image on my development mac book pro with no issues(latest Docker, version 2.2.05).

How much ram do you have on that box?

You can track usage of currently running containers through docker stats watch it closely before the build gets killed. Consider also how much memory is used by the remaining system.

1 Like

Thanks never thought of that, it’s the smallest DO vps available. I can make another larger vps but I will run docker stats and see first.

I think you’re right about the ram limitation causing the compile error.

I made a new instance with 2GB ram(the compile failure happened on a bargain-basement 1GB instance).

ran the docker build command on the 2GB instance and watched docker stats… at the critical time where it was compiling the elixir unicode library, I saw the memory usage crest past 55%. 55% of 2GB is 1.1GB, which would mean that 1GB is not enough to compile elixir.

Nice one!