From 3d101a705df2339bb188375775d6a9189ca02165 Mon Sep 17 00:00:00 2001 From: Val Hendrix Date: Wed, 19 Feb 2020 12:56:55 -0800 Subject: [PATCH] Refactor docker-entrypoint.sh to wait for postgres db to be available Closes #16 --- docker-entrypoint.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 7bc2b51..71b227a 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -9,6 +9,15 @@ fi if [ "$1" = 'bin/catalina.sh' ]; then + echo + echo '**************************************' + echo "Waiting for Postgress to start " + echo '**************************************' + echo + while ! nc -z "${DB_HOST:-db}" "${DB_PORT:-5432}"; do + sleep 0.1 + done + METACAT_DEFAULT_WAR=/usr/local/tomcat/webapps/metacat.war METACAT_DIR=/usr/local/tomcat/webapps/${METACAT_APP_CONTEXT}