Postgres-docker

This commit is contained in:
Arnold Dechamps 2024-03-26 16:10:48 +01:00
parent aa04640fb0
commit ecf2d7149a
No known key found for this signature in database
GPG key ID: AE66543374E41C89
2 changed files with 20 additions and 0 deletions

View file

@ -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:

View file

@ -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