From 3c512c77880418cfad769bb9284dd8eb8d3326d0 Mon Sep 17 00:00:00 2001 From: sn0w Date: Sun, 30 Dec 2018 14:30:36 +0100 Subject: [PATCH] Move compilation into entrypoint; Call entrypoint on build --- Dockerfile | 5 +---- entrypoint.sh | 13 +++++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 37c78a7..f2f9005 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,8 +70,7 @@ RUN \ # Precompile RUN \ - mix deps.get \ - && mix compile + NO_CONFIG=1 COMPILE_ONLY=1 /entrypoint.sh # Prepare runtime config RUN \ @@ -80,5 +79,3 @@ RUN \ # Insert overrides COPY --chown=pleroma:pleroma ./custom.d /home/pleroma/pleroma - -# Recompiles at runtime if custom.d contained elixir code. diff --git a/entrypoint.sh b/entrypoint.sh index 68c1d3b..a2c2a8e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,15 +3,20 @@ set -e set -x -# Generate a config file -ruby /conf/parser.rb /conf/config.yml > config/runtime-config.exs +if [[ -z "$NO_CONFIG" ]]; then + ruby /conf/parser.rb /conf/config.yml > config/runtime-config.exs +fi -# Recompile if needed -if [[ ! -z "$RECOMPILE" ]]; then +if [[ -n "$COMPILE_ONLY" ]]; then mix deps.get mix compile + exit 0 fi +# Assume that dependencies are compiled and ready to go. +# Remove this assumption when https://github.com/erlang/rebar3/issues/1627 is fixed. +mix compile + # Migrate db mix ecto.create mix ecto.migrate