Browse Source

Merge pull request #49 from pdme/master

Wait for mysql to be up before executing
pull/53/merge
o1lab 6 years ago committed by GitHub
parent
commit
0c277f9273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      docker-entrypoint.sh

13
docker-entrypoint.sh

@ -1,3 +1,16 @@
#!/bin/sh
# https://stackoverflow.com/questions/25503412/how-do-i-know-when-my-docker-mysql-container-is-up-and-mysql-is-ready-for-taking
set -e
until nc -z -v -w30 $DATABASE_HOST 3306
do
echo "Waiting for database connection..."
# wait for 5 seconds before check again
sleep 5
done
echo "Mysql is up - executing command"
cd /usr/src/app/
node index.js -h $DATABASE_HOST -p $DATABASE_PASSWORD -d $DATABASE_NAME -u $DATABASE_USER -n 80 -r 0.0.0.0

Loading…
Cancel
Save