2018-04-07 20:29:55 +00:00
|
|
|
#!/bin/ash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2018-04-09 09:55:52 +00:00
|
|
|
function compile {
|
|
|
|
# Make sure that the tooling is present
|
|
|
|
mix local.hex --force
|
|
|
|
mix local.rebar --force
|
|
|
|
|
|
|
|
# Recompile
|
|
|
|
mix deps.get
|
|
|
|
mix compile
|
|
|
|
}
|
|
|
|
|
|
|
|
# Execute onbuild actions if required
|
|
|
|
if [[ "$1" == "onbuild" ]]; then
|
|
|
|
# On build we use the sources instead of the runtime
|
|
|
|
cd /pleroma
|
|
|
|
compile
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2018-04-08 20:49:07 +00:00
|
|
|
# Ensure that the environment is clean
|
|
|
|
if [[ -d /pleroma-runtime ]]; then
|
|
|
|
rm -rf /pleroma-runtime
|
2018-04-07 20:29:55 +00:00
|
|
|
fi
|
2018-04-08 20:49:07 +00:00
|
|
|
mkdir /pleroma-runtime
|
2018-04-07 20:29:55 +00:00
|
|
|
|
2018-04-08 20:49:07 +00:00
|
|
|
# Copy sources
|
|
|
|
rsync -azI /pleroma/ /pleroma-runtime/
|
2018-04-08 14:15:44 +00:00
|
|
|
|
2018-04-08 20:49:07 +00:00
|
|
|
# Copy overrides
|
|
|
|
rsync -azI /custom.d/ /pleroma-runtime/
|
|
|
|
|
|
|
|
# Go to runtime workspace
|
|
|
|
cd /pleroma-runtime
|
|
|
|
|
2018-04-09 09:55:52 +00:00
|
|
|
# Build
|
|
|
|
compile
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
|
|
# Prepare DB
|
|
|
|
mix ecto.create
|
|
|
|
mix ecto.migrate
|
2018-04-07 20:29:55 +00:00
|
|
|
|
2018-04-08 20:49:07 +00:00
|
|
|
# Liftoff o/
|
|
|
|
exec mix phx.server
|