version: '3.8'

services:
  vps-agent:
    build: .
    container_name: vps-ai-agent
    restart: unless-stopped
    expose:
      - "8001"
    ports:
      - "8001:8001"
    # Monta as credenciais e o socket do docker para o Bot conseguir comandar a VPS raiz!
    volumes:
      - .:/app
      - /var/run/docker.sock:/var/run/docker.sock:rw
      - /:/host_root:ro # Acesso em leitura à VPS para análise
      - ./data:/app/data # Configs dinâmicas (API Keys, etc)
    env_file:
      - .env
    networks:
      - coolify
      - ollama_net
    labels:
        - "traefik.enable=true"
        - "traefik.http.routers.vps-agent.rule=Host(`claw.reifonas.cloud`)"
        - "traefik.http.routers.vps-agent.entrypoints=https"
        - "traefik.http.routers.vps-agent.tls=true"
        - "traefik.http.routers.vps-agent.tls.certresolver=letsencrypt"
        - "traefik.http.services.vps-agent.loadbalancer.server.port=8001"

networks:
  coolify:
    external: true
  ollama_net:
    name: lw4s8g4gc8gss4gkc4gg0wk4
    external: true
