Open expelledboy opened 6 years ago
@expelledboy haven't looked close enough at the actual issue you are having, but you don't need to do this if your goal is the smallest possible image, you should instead include erts and system libs in your release and copy it to a fresh image without Erlang installed in the last stage.
@tsloughter If I included erts and system libs in the release the image layer will be larger than necessary when pushing them between data centers. Unfortunately given the size of some of our services including it with the release would triple the size in some cases, accumulated to 200+ deployments all adds up.
I have it working in the meantime just by manually including the paths. Was just thinking that there seems to be mechanisms is place to achieve it, and I was doing something wrong.
Ah, you want a separate layer that all releases can share.
I am building docker images for erlang releases, with inherited images that use the least possible data -
system/base -> erlang/base -> app/<release>
.I have a
system/base
docker image which installs common packages such asvim
etc.Then I have a
erlang/build
imageFROM system/base:latest
which installs two erlang releases using kerl as follows;As you can see one of the installations includes only a subset of the erlang applications. With
erlang/build
I simply copy the stripped install found at/opt/erlang
and set thePATH
to build aerlang/base
docker image.In a final multistage Dockerfile
FROM erlang/build:latest AS builder
I build the release tar as follows;Which runs this make target;
So this runs relx in an environment using the
erlang/base
erlang install, but then I include the lib dir to the complete installation found in/tmp/erlang/lib
incase it needs a dependancy.The last step in the multistage build then copies
/rel
to/opt/app
and the entry point I run as/opt/app/bin/${BIN} foreground
.What this accomplishes is;
system/base
includes bare minimum packages expected on every instanceerlang/base
includes a stripped down install of erlangapp/<release>
includes the extra libs etc needed to start the releaseBut I just cant get this to actually run without adding the libs to the path manually as follows;
Otherwise it crashes with;
My
relx.config
file is very basic;Dont know whats cutting 🆘 any ideas?