services:
  mongo:
    image: mongo:7.0
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
      interval: 5s
      timeout: 3s
      retries: 10
    volumes:
      - mongo-data:/data/db

  latent-label:
    image: repository.latentai.com/leip-label:latest
    pull_policy: always
    depends_on:
      mongo:
        condition: service_healthy
    gpus: all
    environment:
      NVIDIA_VISIBLE_DEVICES: all
      NVIDIA_DRIVER_CAPABILITIES: compute,utility
      FIFTYONE_DATABASE_URI: mongodb://mongo:27017
      FIFTYONE_DEFAULT_DATASET_DIR: /data
      FIFTYONE_ALLOW_LEGACY_ORCHESTRATORS: "true"
      FIFTYONE_PLUGIN_DIRS: /data/__plugins__
      FIFTYONE_LOG_LEVEL: DEBUG
      LEIP_LICENSE_KEY: ${LEIP_LICENSE_KEY}
    shm_size: "2g"
    ports:
      - "${APP_PORT:-5151}:5151"
    volumes:
      - "${HOST_DATA_DIR:-./data}:/data:rw"

volumes:
  mongo-data:
