version: "3.8"

services:
  ray_head:
    image: verlai/verl:sgl055.latest
    container_name: mvp-ray-head
    command: sleep infinity
    ports:
      - "8265:8265"
    volumes:
      - ./verl:/workspace/verl
      - ./shared:/mnt/shared
    shm_size: "10g"
    ulimits:
      nofile:
        soft: 65536
        hard: 65536
    cap_add:
      - SYS_ADMIN
      - SYS_PTRACE
    networks:
      - mvp-ray-net
    environment:
      HF_HOME: "/mnt/shared/hf"
      HUGGINGFACE_HUB_CACHE: "/mnt/shared/hf/hub"
      TRANSFORMERS_CACHE: "/mnt/shared/hf/transformers"
      HF_ENDPOINT: "https://hf-mirror.com"
      PYTHONUNBUFFERED: "1"

  ray_worker_0:
    image: verlai/verl:sgl055.latest
    container_name: mvp-ray-worker-0
    command: sleep infinity
    volumes:
      - ./verl:/workspace/verl
      - ./shared:/mnt/shared
    shm_size: "10g"
    ulimits:
      nofile:
        soft: 65536
        hard: 65536
    cap_add:
      - SYS_ADMIN
      - SYS_PTRACE
    networks:
      - mvp-ray-net
    runtime: nvidia
    environment:
      NVIDIA_VISIBLE_DEVICES: "0,1,2,3"
      NVIDIA_DRIVER_CAPABILITIES: "all"
      HF_HOME: "/mnt/shared/hf"
      HUGGINGFACE_HUB_CACHE: "/mnt/shared/hf/hub"
      TRANSFORMERS_CACHE: "/mnt/shared/hf/transformers"
      HF_ENDPOINT: "https://hf-mirror.com"
      PYTHONUNBUFFERED: "1"

  ray_worker_1:
    image: verlai/verl:sgl055.latest
    container_name: mvp-ray-worker-1
    command: sleep infinity
    volumes:
      - ./verl:/workspace/verl
      - ./shared:/mnt/shared
    shm_size: "10g"
    ulimits:
      nofile:
        soft: 65536
        hard: 65536
    cap_add:
      - SYS_ADMIN
      - SYS_PTRACE
    networks:
      - mvp-ray-net
    runtime: nvidia
    environment:
      NVIDIA_VISIBLE_DEVICES: "4,5,6,7"
      NVIDIA_DRIVER_CAPABILITIES: "all"
      HF_HOME: "/mnt/shared/hf"
      HUGGINGFACE_HUB_CACHE: "/mnt/shared/hf/hub"
      TRANSFORMERS_CACHE: "/mnt/shared/hf/transformers"
      HF_ENDPOINT: "https://hf-mirror.com"
      PYTHONUNBUFFERED: "1"

networks:
  mvp-ray-net:
    driver: bridge
