# ============================================================
# docker-compose.yml - Production
# Project: BCNN Affairs
# ============================================================
# Usage:
#   docker compose up -d            # Start in background
#   docker compose down              # Stop
#   docker compose logs -f affairs   # View logs
#   docker compose up -d --build     # Rebuild and start
# ============================================================

services:
  affairs:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: affairs-app
    restart: unless-stopped
    ports:
      - "3008:3008"
    env_file:
      - .env
    environment:
      - NODE_ENV=production
      - PORT=3008
      - HOST=0.0.0.0
    volumes:
      - uploads_data:/app/.output/public/uploads
    networks:
      - affairs_network
    extra_hosts:
      - "host.docker.internal:host-gateway"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3008/affairs/"]
      interval: 30s
      timeout: 10s
      start_period: 40s
      retries: 3

volumes:
  uploads_data:
    driver: local

networks:
  affairs_network:
    driver: bridge
