services:
  whisper:
    image: ghcr.io/speaches-ai/speaches:latest-cuda
    container_name: whisper-transcribe
    restart: unless-stopped
    ports:
      - "127.0.0.1:${WHISPER_PORT:-9000}:8000"
    environment:
      WHISPER__MODEL: ${WHISPER_MODEL:-Systran/faster-whisper-large-v3}
      WHISPER__DEVICE: ${WHISPER_DEVICE:-cuda}
      WHISPER__COMPUTE_TYPE: ${WHISPER_COMPUTE_TYPE:-float16}
      WHISPER__CPU_THREADS: ${WHISPER_CPU_THREADS:-4}
      # -1 表示模型常驻显存；改为正数（秒）可让空闲模型自动卸载
      WHISPER__TTL: ${WHISPER_TTL:--1}
      # 模型下载地址：国内默认走 hf-mirror.com 镜像；能直连 Hugging Face 时在 .env 里设 HF_ENDPOINT=（留空）
      HF_ENDPOINT: ${HF_ENDPOINT:-https://hf-mirror.com}
    volumes:
      - hf-hub-cache:/home/ubuntu/.cache/huggingface/hub
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]

volumes:
  hf-hub-cache:
