-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.prod.sh
40 lines (31 loc) · 1.04 KB
/
entrypoint.prod.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
#!/bin/sh
if [ "$DATABASE" = "postgres" ]
then
echo "Waiting for postgres..."
while ! nc -z $SQL_HOST $SQL_PORT; do
sleep 0.1
done
echo "PostgreSQL started"
fi
CONTAINER_ALREADY_STARTED="CONTAINER_ALREADY_STARTED_PLACEHOLDER"
if [ ! -e $CONTAINER_ALREADY_STARTED ]; then
touch $CONTAINER_ALREADY_STARTED
echo "-- First container startup --"
# YOUR_JUST_ONCE_LOGIC_HERE
python manage.py flush --no-input
python manage.py makemigrations
python manage.py migrate --noinput
python manage.py collectstatic
# CREATE GROUPS
python manage.py create_groups
# ADD DATA - fixtures
python manage.py loaddata customers.json staff.json rooms.json events.json
# CREATE SUPER USER
# Look at .env.prod file to setup username and password
echo "Creating Super User - remember to change the .env.prod file"
python manage.py createsuperuser --noinput --username $DJANGO_SUPERUSER_USERNAME --email $DJANGO_SUPERUSER_EMAIL
else
echo "-- Not first container startup --"
fi
history -c
exec "$@"