From a72cfa9b4e1c916dd98fa043b48e62fc7813411c Mon Sep 17 00:00:00 2001 From: sn0w Date: Thu, 10 Jan 2019 19:32:40 +0100 Subject: [PATCH] Wait for db during launch --- Dockerfile | 2 +- entrypoint.sh | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0bd34a5..2f0634c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ diff --git a/entrypoint.sh b/entrypoint.sh index 6abb603..6f078d2 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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!