version: '2.4'

services:
  cuda:
    image: nvcr.io/nvidia/l4t-cuda:12.2.12-runtime
    privileged: true
    network_mode: host
    restart: unless-stopped
    environment:
      - UDEV=1
      - NVIDIA_VISIBLE_DEVICES=all
      - NVIDIA_DRIVER_CAPABILITIES=all
    devices:
      - "/dev/video0:/dev/video0"
      - "/dev/nvhost-ctrl:/dev/nvhost-ctrl"
      - "/dev/nvhost-ctrl-gpu:/dev/nvhost-ctrl-gpu"
      - "/dev/nvhost-prof-gpu:/dev/nvhost-prof-gpu"
      - "/dev/nvhost-gpu:/dev/nvhost-gpu"
      - "/dev/nvmap:/dev/nvmap"
      - "/dev/nvhost-ctxsw-gpu:/dev/nvhost-ctxsw-gpu"
    labels:
      io.balena.features.nvidia: '1'
    command: ["bash", "-lc", "echo CUDA ready; nvcc --version || true; sleep infinity"]
