# docker-compose.workers.yml - Multiple PaddleOCR workers for parallel Ray Tune # # Usage: # GPU (4 workers sharing GPU): # docker compose -f docker-compose.workers.yml up # # CPU (4 workers): # docker compose -f docker-compose.workers.yml --profile cpu up # # Scale workers (e.g., 8 workers): # NUM_WORKERS=8 docker compose -f docker-compose.workers.yml up # # Each worker runs on a separate port: 8001, 8002, 8003, 8004, ... x-ocr-gpu-common: &ocr-gpu-common image: seryus.ddns.net/unir/paddle-ocr-gpu:latest volumes: - ../dataset:/app/dataset:ro - ../debugset:/app/debugset:rw - paddlex-cache:/root/.paddlex environment: - PYTHONUNBUFFERED=1 - CUDA_VISIBLE_DEVICES=0 deploy: resources: reservations: devices: - driver: nvidia count: 1 capabilities: [gpu] restart: unless-stopped healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] interval: 30s timeout: 10s retries: 3 start_period: 120s x-ocr-cpu-common: &ocr-cpu-common image: seryus.ddns.net/unir/paddle-ocr-cpu:latest volumes: - ../dataset:/app/dataset:ro - ../debugset:/app/debugset:rw - paddlex-cache:/root/.paddlex environment: - PYTHONUNBUFFERED=1 restart: unless-stopped healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] interval: 30s timeout: 10s retries: 3 start_period: 120s services: # GPU Workers (gpu profile) - share single GPU ocr-worker-1: <<: *ocr-gpu-common container_name: paddle-ocr-worker-1 ports: - "8001:8000" profiles: - gpu ocr-worker-2: <<: *ocr-gpu-common container_name: paddle-ocr-worker-2 ports: - "8002:8000" profiles: - gpu ocr-worker-3: <<: *ocr-gpu-common container_name: paddle-ocr-worker-3 ports: - "8003:8000" profiles: - gpu ocr-worker-4: <<: *ocr-gpu-common container_name: paddle-ocr-worker-4 ports: - "8004:8000" profiles: - gpu ocr-worker-5: <<: *ocr-gpu-common container_name: paddle-ocr-worker-5 ports: - "8005:8000" profiles: - gpu # CPU Workers (cpu profile) - for systems without GPU ocr-cpu-worker-1: <<: *ocr-cpu-common container_name: paddle-ocr-cpu-worker-1 ports: - "8001:8000" profiles: - cpu ocr-cpu-worker-2: <<: *ocr-cpu-common container_name: paddle-ocr-cpu-worker-2 ports: - "8002:8000" profiles: - cpu ocr-cpu-worker-3: <<: *ocr-cpu-common container_name: paddle-ocr-cpu-worker-3 ports: - "8003:8000" profiles: - cpu ocr-cpu-worker-4: <<: *ocr-cpu-common container_name: paddle-ocr-cpu-worker-4 ports: - "8004:8000" profiles: - cpu ocr-cpu-worker-5: <<: *ocr-cpu-common container_name: paddle-ocr-cpu-worker-5 ports: - "8005:8000" profiles: - cpu volumes: paddlex-cache: name: paddlex-model-cache