# deploy/docker-compose.prod.yml — prod 오버라이드(Postgres 승격 + 리소스 제한)
# 사용: docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
services:
  db:
    image: postgres:16-alpine
    environment:
      POSTGRES_USER: ari
      POSTGRES_PASSWORD_FILE: /run/secrets/pg_password
      POSTGRES_DB: ari
    volumes:
      - pg-data:/var/lib/postgresql/data
    secrets: [pg_password]
    restart: unless-stopped

  backend:
    environment:
      DATABASE_URL: postgresql+psycopg://ari:@db:5432/ari
      COOKIE_SECURE: "true"
      ARI_ENV: prod
    depends_on: [db, ollama]
    deploy:
      resources:
        limits: { cpus: "2.0", memory: 1024M }

  worker:
    environment:
      DATABASE_URL: postgresql+psycopg://ari:@db:5432/ari
    depends_on: [db, ollama]

  frontend:
    deploy:
      resources:
        limits: { cpus: "1.0", memory: 512M }

volumes:
  pg-data:

secrets:
  pg_password:
    file: ./secrets/pg_password.txt
