Skip to content

Instantly share code, notes, and snippets.

@tag1216
Created January 23, 2017 07:24
Show Gist options
  • Save tag1216/34325d6ecb96861e465a8cdbeab8bcda to your computer and use it in GitHub Desktop.
Save tag1216/34325d6ecb96861e465a8cdbeab8bcda to your computer and use it in GitHub Desktop.
DjangoをDocker Composeで動かすときにDBが起動するまで待つ
command: ["./wait-for-db.sh", "--", "python", "manage.py", "runserver", "0.0.0.0:8000"]
#!/bin/bash
set -e
shift
cmd="$@"
until ./manage.py inspectdb; do
>&2 echo "Database is unavailable - sleeping"
sleep 1
done
>&2 echo "Database is up - executing command"
exec $cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment