version: '3.8'

services:
  agent-node:
    build: ./agent-node
    container_name: ${AGENT_NODE_ID:-cortex_sandbox_node}
    restart: always
    environment:
      - AGENT_NODE_ID=${AGENT_NODE_ID:-sandbox-node}
      - AGENT_NODE_DESC=${AGENT_NODE_DESC:-Attached Local Sandbox Node}
      - GRPC_ENDPOINT=${GRPC_ENDPOINT:-ai-hub:50051}
      - AGENT_AUTH_TOKEN=${AGENT_AUTH_TOKEN}
      - AGENT_SECRET_KEY=${AGENT_SECRET_KEY:-default-insecure-key}
      - AGENT_TLS_ENABLED=${AGENT_TLS_ENABLED:-false}
    volumes:
      - ./agent-node:/app/agent-node-source:ro
      - ${AGENT_NODE_ID:-sandbox-node}_sync:/app/sync
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 512M
    # Allows it to route to localhost:50051 if running outside the main docker network
    extra_hosts:
      - "host.docker.internal:host-gateway"

volumes:
  # Dynamic volume generation per node
  sandbox-node_sync:
    driver: local
