Wait for db during launch

This commit is contained in:
sn0w 2019-01-10 19:32:40 +01:00
parent 2acfbc8842
commit a72cfa9b4e
No known key found for this signature in database
GPG Key ID: DDEDFB9D3FA15727
2 changed files with 9 additions and 2 deletions

View File

@ -14,7 +14,7 @@ EXPOSE 4000
# Get dependencies
RUN \
apk add --no-cache --virtual .tools \
git curl \
git curl postgresql-client \
\
&& apk add --no-cache --virtual .sdk \
build-base \

View File

@ -13,10 +13,17 @@ if [ -n "$BUILDTIME" ]; then
exit 0
fi
set +x
while ! pg_isready -U pleroma -d postgres://db:5432/pleroma -t 1; do
echo "[X] Database is starting up..."
sleep 1s
done
set -x
# Recompile
mix compile
# Migrate db
mix ecto.create
mix ecto.migrate
# Off we go!