services:
  app:
    build:
      context: ..
      dockerfile: app/Dockerfile
    environment:
      - DATABASE_URL=mysql+pymysql://$MARIADB_USER:$MARIADB_PASSWORD@db:3306/$MARIADB_DATABASE
      - SECRET_KEY=${SECRET_KEY}
      - OPENAI_API_KEY=${OPENAI_API_KEY}
      - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
      - OPENROUTER_API_KEY=${OPENROUTER_API_KEY}
    ports:
      - "${APP_PORT}:8000"
    depends_on:
      - db
      - qdrant
    volumes:
      - ../app:/app
      - ../docs:/app/docs
      - ../crumbforest_config.json:/config/crumbforest_config.json

  db:
    image: mariadb:11
    environment:
      - MARIADB_DATABASE=${MARIADB_DATABASE}
      - MARIADB_USER=${MARIADB_USER}
      - MARIADB_PASSWORD=${MARIADB_PASSWORD}
      - MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD}
    volumes:
      - ${MYSQL_DATA}:/var/lib/mysql
      - ./init:/docker-entrypoint-initdb.d:ro

  qdrant:
    image: qdrant/qdrant:latest
    volumes:
      - ${QDRANT_STORAGE}:/qdrant/storage
    ports:
      - "127.0.0.1:6333:6333" # Nur localhost - sicher!
