services: # ── Base de données PostgreSQL ────────────────────────── db: image: postgres:16-alpine restart: always volumes: - postgres_data_dev:/var/lib/postgresql/data env_file: .env.dev healthcheck: test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] interval: 10s timeout: 5s retries: 5 # ── Application Django (Gunicorn) ─────────────────────── web: build: . restart: always env_file: .env.dev volumes: - static_volume_dev:/app/staticfiles - media_volume_dev:/app/media depends_on: db: condition: service_healthy command: sh -c "python manage.py migrate --noinput && gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 2 --timeout 60 --access-logfile - --error-logfile -" # ── Caddy (reverse proxy + HTTPS automatique) ─────────── caddy: image: caddy:2-alpine restart: always ports: - "80:80" - "443:443" - "443:443/udp" volumes: - ./Caddyfile.dev:/etc/caddy/Caddyfile:ro - static_volume_dev:/app/staticfiles:ro - media_volume_dev:/app/media:ro depends_on: - web volumes: postgres_data_dev: static_volume_dev: media_volume_dev: