# ============================================================ # Docker Compose — Production # # Architecture : # [Nginx Proxy Manager] ──► [FrankenPHP app:80] # │ # [PostgreSQL] # [Queue Worker] # # Le réseau "proxy" est externe (géré par Nginx Proxy Manager). # Dans NPM, configure un proxy host vers : http://landing-api-app:80 # # Usage : # docker compose -f compose.prod.yaml up -d # ============================================================ services: # ── Application FrankenPHP (web + PHP tout-en-un) ─────── app: build: context: . dockerfile: docker/Dockerfile.prod image: landing-api:latest container_name: landing-api-app restart: unless-stopped env_file: - .env environment: APP_ENV: production APP_DEBUG: "false" SERVER_NAME: ":80" # FrankenPHP écoute sur le port 80 volumes: - app_storage:/app/storage/app - app_logs:/app/storage/logs networks: - proxy # réseau NPM pour être accessible depuis l'extérieur - internal # réseau interne pour parler à PostgreSQL depends_on: pgsql: condition: service_healthy # ── Base de données PostgreSQL ────────────────────────── pgsql: image: postgres:17-alpine container_name: landing-api-pgsql restart: unless-stopped environment: POSTGRES_DB: "${DB_DATABASE}" POSTGRES_USER: "${DB_USERNAME}" POSTGRES_PASSWORD: "${DB_PASSWORD}" PGDATA: /var/lib/postgresql/data/pgdata volumes: - pgsql_data:/var/lib/postgresql/data networks: - internal # PostgreSQL n'est PAS exposé sur le réseau proxy healthcheck: test: ["CMD-SHELL", "pg_isready -q -d ${DB_DATABASE} -U ${DB_USERNAME}"] interval: 10s timeout: 5s retries: 5 start_period: 30s # ── Worker Laravel Queue ──────────────────────────────── queue: build: context: . dockerfile: docker/Dockerfile.prod image: landing-api:latest container_name: landing-api-queue restart: unless-stopped command: ["php", "artisan", "queue:work", "--sleep=3", "--tries=3", "--max-time=3600"] env_file: - .env environment: APP_ENV: production APP_DEBUG: "false" volumes: - app_storage:/app/storage/app - app_logs:/app/storage/logs networks: - internal depends_on: pgsql: condition: service_healthy networks: # Réseau externe partagé avec Nginx Proxy Manager proxy: external: true # Réseau interne isolé (app ↔ pgsql ↔ queue) internal: driver: bridge volumes: pgsql_data: driver: local app_storage: driver: local app_logs: driver: local