# Wild Dragon MAM — GPU overlay
# Apply on top of docker-compose.yml on nodes with NVIDIA GPUs.
#
# Prerequisites: NVIDIA Container Toolkit installed on the host.
#   Install: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/
#
# Usage (core MAM node with GPUs):
#   docker compose -f docker-compose.yml -f docker-compose.gpu.yml up -d
#
# Usage (worker node with GPUs):
#   docker compose -f docker-compose.worker.yml -f docker-compose.gpu.yml --profile worker up -d
#
# This overlay:
#   - Rebuilds worker from Dockerfile.gpu (CUDA base + ffmpeg NVENC)
#   - Passes all NVIDIA GPUs into the worker container
#   - Sets NVENC_ENABLED=true so the worker prioritises h264_nvenc/hevc_nvenc

services:
  worker:
    build:
      context: ./services/worker
      dockerfile: Dockerfile.gpu
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    environment:
      NVENC_ENABLED:              "true"
      NVIDIA_VISIBLE_DEVICES:     all
      NVIDIA_DRIVER_CAPABILITIES: video,compute,utility
