version: '3.8'

services:
  chroma:
    image: chromadb/chroma
    ports:
      - "8004:8000"
    volumes:
      - ./chroma_data:/chroma/.chroma/index
    # healthcheck:
    #   test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/heartbeat"]
    #   interval: 30s
    #   timeout: 10s
    #   retries: 5

  indexing:
    build:
      context: .
      dockerfile: Dockerfile
    command: python indexing.py
    volumes:
      - .:/app
    env_file:
      - .env
    depends_on:
      - chroma
  
  api:
    build:
      context: .
      dockerfile: Dockerfile
    command: uvicorn api:app --host 0.0.0.0 --port 8001 --reload
    ports:
      - "8001:8001"
    volumes:
      - .:/app
    env_file:
      - .env
    depends_on:
      - chroma
      - indexing

  ui:
    build:
      context: .
      dockerfile: Dockerfile
    command: streamlit run ui.py --server.port 8501 --server.address 0.0.0.0
    ports:
      - "8501:8501"
    volumes:
      - .:/app
    env_file:
      - .env
    depends_on:
      - api 