pleroma-docker/entrypoint.ash

56 lines
976 B
Plaintext
Raw Normal View History

2018-04-07 16:29:55 -04:00
#!/bin/ash
set -e
2018-04-09 05:55:52 -04:00
function compile {
# Make sure that the tooling is present
2018-04-09 06:17:46 -04:00
if [[ ! -d /mix-archives/hex-* ]] || [[ ! -f /mix/rebar ]] || [[ ! -f /mix/rebar3 ]]; then
mix local.hex --force
mix local.rebar --force
fi
2018-04-09 05:55:52 -04:00
# Recompile
mix deps.get
mix compile
}
# Execute onbuild actions if required
if [[ "$1" == "onbuild" ]]; then
2018-04-09 06:17:46 -04:00
# Pretend we're in runtime mode
mv /pleroma /pleroma-runtime
cd /pleroma-runtime
# Build pleroma
2018-04-09 05:55:52 -04:00
compile
2018-04-09 06:17:46 -04:00
# Put precompiled sources back
cd /
mv /pleroma-runtime /pleroma
2018-04-09 05:55:52 -04:00
exit 0
fi
2018-04-08 16:49:07 -04:00
# Ensure that the environment is clean
if [[ -d /pleroma-runtime ]]; then
rm -rf /pleroma-runtime
2018-04-07 16:29:55 -04:00
fi
2018-04-08 16:49:07 -04:00
mkdir /pleroma-runtime
2018-04-07 16:29:55 -04:00
2018-04-08 16:49:07 -04:00
# Copy sources
rsync -azI /pleroma/ /pleroma-runtime/
2018-04-08 10:15:44 -04:00
2018-04-08 16:49:07 -04:00
# Copy overrides
rsync -azI /custom.d/ /pleroma-runtime/
# Go to runtime workspace
cd /pleroma-runtime
2018-04-09 05:55:52 -04:00
# Build
compile
2018-04-08 16:49:07 -04:00
# Prepare DB
mix ecto.create
mix ecto.migrate
2018-04-07 16:29:55 -04:00
2018-04-08 16:49:07 -04:00
# Liftoff o/
exec mix phx.server