services:
  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    ports:
      - "8080:8080"
    environment:
      - MILVUS_HOST=${MILVUS_HOST}
      - MILVUS_PORT=${MILVUS_PORT}
      - BACKEND_MINIO_BUCKET_NAME=${BACKEND_MINIO_BUCKET_NAME}
      - BACKEND_MINIO_ALIAS=${BACKEND_MINIO_ALIAS}
      - MINIO_SECURE=${MINIO_SECURE}
    depends_on:
      - "milvus"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "5"
  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile
    ports:
      - "8501:8501"
    environment:
      - BACKEND_URL=${BACKEND_URL}
    depends_on:
      - "backend"
  etcd:
    container_name: milvus-etcd
    image: quay.io/coreos/etcd:v3.5.21
    environment:
      - ETCD_AUTO_COMPACTION_MODE=${ETCD_AUTO_COMPACTION_MODE}
      - ETCD_AUTO_COMPACTION_RETENTION=${ETCD_AUTO_COMPACTION_RETENTION}
      - ETCD_QUOTA_BACKEND_BYTES=${ETCD_QUOTA_BACKEND_BYTES}
      - ETCD_SNAPSHOT_COUNT=${ETCD_SNAPSHOT_COUNT}
    volumes:
      - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/etcd:/etcd
    command: etcd -advertise-client-urls=http://etcd:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd
    healthcheck:
      test: ["CMD", "etcdctl", "endpoint", "health"]
      interval: 30s
      timeout: 20s
      retries: 3
  minio:
    container_name: milvus-minio
    image: minio/minio:RELEASE.2025-04-22T22-12-26Z
    environment:
      - MINIO_ROOT_USER=${MINIO_ROOT_USER}
      - MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}
    ports:
      - "9001:9001"
      - "9000:9000"
    volumes:
      - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/minio:/minio_data
    command: minio server /minio_data --console-address ":9001"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
      interval: 30s
      timeout: 20s
      retries: 3
  milvus:
    container_name: milvus-standalone
    image: milvusdb/milvus:v2.5.11
    command: ["milvus", "run", "standalone"]
    security_opt:
      - seccomp:unconfined
    environment:
      ETCD_ENDPOINTS: etcd:2379
      MINIO_ADDRESS: minio:9000
    volumes:
      - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/milvus:/var/lib/milvus
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"]
      interval: 30s
      start_period: 90s
      timeout: 20s
      retries: 3
    ports:
      - "19530:19530"
      - "9091:9091"
    depends_on:
      - "etcd"
      - "minio"
  attu:
    image: zilliz/attu:v2.5.6
    ports:
      - "3001:3001"
    environment:
      - HOST_URL=${ATTU_HOST_URL}
      - SERVER_PORT=3001
      - MILVUS_URL=milvus:19530
      - ATTU_LOG_LEVEL=debug
    depends_on:
      - "milvus"
  flowise:
    image: flowiseai/flowise:latest
    ports:
      - "3000:3000"
    environment:
      - PORT=3000
    depends_on:
      - "milvus"
