-
-
Notifications
You must be signed in to change notification settings - Fork 301
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·32 lines (26 loc) · 1.05 KB
/
entrypoint.sh
File metadata and controls
executable file
·32 lines (26 loc) · 1.05 KB
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
#!/bin/bash
set -e
info() { echo >&2 "[$(date --iso-8601=seconds)] $*"; }
die() {
echo >&2 "$*"
exit 1
}
trap exit TERM
# web container is running gunicorn, so we know to use that for migrations/init-db
# other containers (celery, celery-beat, etc) just run their commands and are started
# after web-container as depends_on in docker-compose.yml
if [ "$1" = "gunicorn" ]; then
# we run all the migrations if needed, it is no-op if none needed
info "**** Checking needed migrations"
python manage.py migrate || die "failed to migrate"
info "**** Migrations done"
info "**** Checking if database is initialized"
python manage.py initdb || die "Failed to initialize database"
# after each update of assets, we run collectstatic, if it is already done, it is quick command
# to check
info "**** Checking static asset collection"
python manage.py compile_themes || die "failed to compile themes"
python manage.py collectstatic --no-input || die "failed to collect static"
info "**** Static assets collected"
fi
exec "$@"