services:

  unit-lint:
    build:
      context: .
      target: unit-lint
    volumes:
      - .:/var/app

  integration-test:
    build:
      context: .
      target: integration-test
    depends_on:
      marketing-intelligence-deploy:
        condition: service_healthy
    environment:
      - QA_BASE_URL=http://marketing-intelligence-deploy:8080
    volumes:
      - .:/var/app

  marketing-intelligence-dev:
    build:
      context: .
      target: dev
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:5000/hello/"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 40s
    environment:
      - Environment=dev
      - DD_ENV=dev
      - DD_SERVICE=marketing-intelligence
      - DD_AGENT_HOST=dev-datadog-agent.dev.theorchard.io
      - DD_TRACE_ENABLED=1
      - DD_PROFILING_ENABLED=1
    volumes:
      - .:/var/app

  marketing-intelligence-mcp:
    build:
      context: .
      target: deploy-mcp
    shm_size: 1g
    healthcheck:
      test: ["CMD", "curl", "-sf", "http://localhost:8001/health"]
      interval: 30s
      timeout: 10s
      retries: 5
      start_period: 90s
    environment:
      - STORAGE_BACKEND=local
      - DD_ENV=dev
      - DD_SERVICE=marketing-intelligence-mcp
      - DD_AGENT_HOST=dev-datadog-agent.dev.theorchard.io
      - ANTHROPIC_API_KEY
      - PROXY_LIST
    volumes:
      - ./output:/var/app/output
    ports:
      - "8001:8001"

  marketing-intelligence-deploy:
    build:
      context: .
      target: deploy
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/hello/"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 40s
    depends_on:
      marketing-intelligence-mcp:
        condition: service_started
    environment:
      - Environment=dev
      - DD_ENV=dev
      - DD_SERVICE=marketing-intelligence
      - DD_AGENT_HOST=dev-datadog-agent.dev.theorchard.io
      - DD_TRACE_ENABLED=1
      - DD_PROFILING_ENABLED=1
      - MCP_SERVER_URL=http://marketing-intelligence-mcp:8001/mcp
      - ANTHROPIC_API_KEY
      - AGENT_BACKEND
      - AWS_ACCESS_KEY_ID
      - AWS_SECRET_ACCESS_KEY
      - AWS_SESSION_TOKEN
      - AWS_DEFAULT_REGION=us-east-1
    volumes:
      - ./output:/var/app/output

  uv-lock-upgrade:
    image: ghcr.io/astral-sh/uv:python3.14-alpine
    working_dir: /var/app
    command: uv lock --upgrade
    volumes:
      - .:/var/app

