generated from Code4PuertoRico/base-repo
-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-entrypoint.sh
executable file
·56 lines (45 loc) · 1.22 KB
/
docker-entrypoint.sh
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
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
set -euo pipefail
postgres_ready() {
pipenv run 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 "==> Running migrations..."
pipenv run python manage.py makemigrations
pipenv run python manage.py migrate
echo "==> Loading initial data..."
pipenv run python manage.py loaddata "una_hora/users/fixtures/initial.json"
echo "==> Running web dev server..."
pipenv run python manage.py runserver 0.0.0.0:8000
;;
"dev_tailwind_start")
echo "==> Installing frontend dependencies..."
pipenv run python manage.py tailwind install
echo "==> Preparing frontend assets..."
pipenv run python manage.py tailwind build
pipenv run python manage.py collectstatic --no-input
echo "==> Running frontend..."
pipenv run python manage.py tailwind start
;;
"pre_commit")
echo "==> Running pre-commit..."
pipenv run pre-commit run --all-files
;;
*)
exec "$@"
;;
esac