# Example Docker Compose configuration for all-smi with Rebellions NPU support
# This demonstrates how to properly mount host /proc for PID mapping

version: '3.8'

services:
  all-smi-monitor:
    image: all-smi:latest
    build:
      context: ..
      dockerfile: Dockerfile
    command: ["view"]
    privileged: true  # Required for NPU device access
    pid: host        # Alternative: use host PID namespace
    volumes:
      # Mount host /proc for PID mapping when running in container namespace
      - /proc:/host/proc:ro
      # Mount NPU device files
      - /dev:/dev
    environment:
      # Tell all-smi where to find host proc
      HOST_PROC_PATH: /host/proc
    devices:
      # Rebellions NPU devices
      - /dev/rbln0
      - /dev/rbln1
      - /dev/rbln2
      - /dev/rbln3

  # API mode for Prometheus metrics
  all-smi-api:
    image: all-smi:latest
    command: ["api", "--port", "9090"]
    ports:
      - "9090:9090"
    privileged: true
    volumes:
      - /proc:/host/proc:ro
      - /dev:/dev
    devices:
      - /dev/rbln0
      - /dev/rbln1
      - /dev/rbln2
      - /dev/rbln3

  # Example with PID namespace sharing (simpler but less isolated)
  all-smi-shared-pid:
    image: all-smi:latest
    command: ["view"]
    pid: host  # Share host PID namespace - PIDs will match
    privileged: true
    volumes:
      - /dev:/dev
    devices:
      - /dev/rbln0
      - /dev/rbln1
      - /dev/rbln2
      - /dev/rbln3