# docker-compose.gpu-registry.yml - Pull GPU image from registry
# Usage: docker compose -f docker-compose.gpu-registry.yml up
#
# Requires: NVIDIA GPU + nvidia-container-toolkit installed

services:
  ocr-gpu:
    image: seryus.ddns.net/unir/paddle-ocr-gpu:latest
    container_name: paddle-ocr-gpu-registry
    ports:
      - "8002:8000"
    volumes:
      - ../dataset:/app/dataset:ro
      - ../debugset:/app/debugset:rw
      - paddlex-cache:/root/.paddlex
      - ./scripts:/app/scripts:ro
    environment:
      - PYTHONUNBUFFERED=1
      - CUDA_VISIBLE_DEVICES=0
      - PADDLE_DET_MODEL=PP-OCRv5_mobile_det
      - PADDLE_REC_MODEL=PP-OCRv5_mobile_rec
    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: 60s

volumes:
  paddlex-cache:
    name: paddlex-model-cache
