name: quven

services:
  quven:
    image: ${QUVEN_IMAGE:?Set QUVEN_IMAGE to an immutable version tag or digest.}
    init: true
    network_mode: host
    read_only: true
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    cap_drop:
      - ALL
    stop_grace_period: 45s
    # Transcription writes timestamp-preserving 16 kHz mono PCM (~230 MB for a two-hour film) and
    # bitmap OCR writes one PNG per cue, both under /tmp on a read-only rootfs.
    tmpfs:
      - /tmp:mode=1777,size=${QUVEN_TMPFS_SIZE:-4g}
    user: "10001:10001"
    environment:
      ASPNETCORE_URLS: ${QUVEN_URLS:-http://0.0.0.0:5181}
    volumes:
      - type: volume
        source: quven-data
        target: /data
      # Writable so the subtitles Quven produces land beside the film; the directory has to be
      # writable by uid 10001 for that. Set QUVEN_MEDIA_READ_ONLY=true to keep the library out of
      # the server's reach, which costs only that copy: the transcript is kept and served anyway.
      - type: bind
        source: ${QUVEN_MEDIA_DIR:?Set QUVEN_MEDIA_DIR to the absolute host media root.}
        target: /media
        read_only: ${QUVEN_MEDIA_READ_ONLY:-false}

volumes:
  quven-data:
    name: ${QUVEN_DATA_VOLUME:-quven-data}
