spejstore-new/docker-compose.yml

32 lines
892 B
YAML

version: "3"
services:
db:
image: postgres:15.4
restart: unless-stopped
volumes:
- /var/spejstore-pg:/var/lib/postgresql/data
env_file:
- .env.pg
healthcheck:
#CHANGE 1: this command checks if the database is ready, right on the source db server
test: ["CMD-SHELL", "pg_isready -d postgres -U postgres"]
interval: 1s
timeout: 1s
retries: 5
web:
build: .
user: root
restart: unless-stopped
command: bash -c "python manage.py collectstatic --no-input --clear && python manage.py migrate && gunicorn --workers 1 --threads 4 -b 0.0.0.0:8000 --capture-output --error-logfile - --access-logfile - spejstore.wsgi:application"
volumes:
- .:/code
- ./build_static:/code/build_static
ports:
- "8021:8000"
env_file:
- .env
depends_on:
db:
condition: service_healthy