-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
·46 lines (36 loc) · 893 Bytes
/
docker-entrypoint.sh
File metadata and controls
executable file
·46 lines (36 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -euo pipefail
# Wait for postgres DB to be ready before continuing
postgres_ready() {
python manage.py shell << END
import sys
import psycopg2
from django.db import connections
try:
connections['default'].cursor()
except psycopg2.OperationalError:
sys.exit(-1)
sys.exit(0)
END
}
until postgres_ready; do
>&2 echo "==> Waiting for Postgres..."
sleep 1
done
case "$1" in
"dev_web_start")
echo "==> Generating OpenAPI schema..."
python manage.py spectacular --color --file schema.yml
echo "==> Creating migrations..."
python manage.py makemigrations hhub
echo "==> Running migrations..."
python manage.py migrate
echo "==> Syncing database..."
python manage.py runscript sync_db
echo "==> Running web dev server..."
python manage.py runserver 0.0.0.0:8000
;;
*)
exec "$@"
;;
esac