version: '3.8'

services:
  # PostgreSQL (reemplaza a Supabase)
  postgres:
    image: postgres:15-alpine
    ports:
      - "5432:5432"
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: postgres
    volumes:
      - postgres_data:/var/lib/postgresql/data

  # Redis
  redis:
    image: redis:7-alpine
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data

  # WACRM (Next.js)
  wacrm:
    build:
      context: ./skeen-wacrm
      dockerfile: Dockerfile
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=development
      - NEXT_PUBLIC_APP_URL=http://localhost:3000
      - NEXT_PUBLIC_SUPABASE_URL=http://localhost:54321
      - NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNrZWVuIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTk3NTc0MDAsImV4cCI6MTkxNzUxMzgwMH0.skeen_dev_key
      - SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNrZWVuIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc1OTc1NzQwMCwiZXhwIjoxOTE3NTEzODAwfQ.skeen_dev_service
      - ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000
    depends_on:
      - postgres
      - redis
    volumes:
      - ./skeen-wacrm:/app
      - /app/node_modules

  # Hermes (Python)
  hermes:
    build:
      context: ./hermes
      dockerfile: Dockerfile
    ports:
      - "8080:8080"
    environment:
      - HERMES_MODEL_PROVIDER=openai
      - HERMES_MODEL=gpt-4o
      - OPENAI_API_KEY=${OPENAI_API_KEY:-sk-test}
      - HERMES_WEBHOOK_PORT=8080
      - HERMES_API_SERVER_ENABLED=true
      - HERMES_CRON_ENABLED=true
      - WACRM_URL=http://wacrm:3000
      - WACRM_API_KEY=wacrm_dev_key
    volumes:
      - ./hermes/.hermes:/root/.hermes
      - ./hermes/skills:/skills:ro
    depends_on:
      - wacrm

volumes:
  postgres_data:
  redis_data:
