# docker-compose.yml — Local development
# Usage: docker compose up -d
# Test:  curl http://localhost:4000/health

services:
  # ── AI Proxy Server ─────────────────────────────────────────
  proxy:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: proxym
    ports:
      - "4000:4000"
    env_file: .env
    environment:
      - REDIS_URL=redis://redis:6379/0
    depends_on:
      redis:
        condition: service_healthy
    volumes:
      # Mount project dir for delta context buffer
      - ./project:/app/project:ro
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:4000/health"]
      interval: 15s
      timeout: 5s
      retries: 3

  # ── Redis (cache + semantic search) ─────────────────────────
  redis:
    image: redis/redis-stack:latest
    container_name: proxym-redis
    ports:
      - "6379:6379"
      - "8001:8001"   # RedisInsight UI
    volumes:
      - redis-data:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 3s
      retries: 5
    restart: unless-stopped


volumes:
  redis-data:
