Postgres-docker
This commit is contained in:
parent
aa04640fb0
commit
ecf2d7149a
|
@ -8,3 +8,11 @@ services:
|
|||
command: gunicorn tldtest.wsgi:application --bind 0.0.0.0:8000 --timeout 600
|
||||
ports:
|
||||
- 8000:8000
|
||||
depends_on:
|
||||
- db
|
||||
db:
|
||||
image: postgres:15
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data/
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
#!/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
|
||||
|
||||
|
||||
python manage.py makemigrations # Make migrations
|
||||
python manage.py migrate # Apply database migrations
|
||||
python manage.py collectstatic
|
||||
|
|
Loading…
Reference in a new issue