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"] 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 -" # ── Nginx (reverse proxy + static files) ─────────────── nginx: image: nginx:alpine restart: always ports: - "80:80" - "443:443" volumes: - ./nginx/nginx.dev-init.conf:/etc/nginx/conf.d/default.conf:ro - static_volume_dev:/app/staticfiles:ro - media_volume_dev:/app/media:ro - certbot_www_dev:/var/www/certbot:ro - certbot_certs_dev:/etc/letsencrypt:ro depends_on: - web # ── Certbot (SSL Let's Encrypt) ───────────────────────── certbot: image: certbot/certbot volumes: - certbot_www_dev:/var/www/certbot - certbot_certs_dev:/etc/letsencrypt entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'" volumes: postgres_data_dev: static_volume_dev: media_volume_dev: certbot_www_dev: certbot_certs_dev: