# High-throughput OCR with MPS multi-instance scaling. # Requires NVIDIA MPS: sudo nvidia-cuda-mps-control -d # # TRT engines are auto-built from ONNX on first startup by the C++ binary. # Cached in the shared volume — built once, used by all instances. # # Usage: # docker compose up -d # Start 7 instances # docker compose up -d --scale ocr=5 # Start 5 instances # docker compose down # Stop all volumes: trt-cache: # Shared TRT engine cache services: ocr: build: context: .. dockerfile: docker/Dockerfile.gpu deploy: resources: reservations: devices: - driver: nvidia count: all capabilities: [gpu] replicas: 7 # See README.md#configuration for all tunables (OCR_LANG, MAX_BODY_MB, # MAX_IMAGE_DIM, DET_MAX_SIDE, etc.). environment: - PIPELINE_POOL_SIZE=3 ports: - "8001-8007:8000" volumes: - trt-cache:/home/ocr/.cache/turbo-ocr restart: unless-stopped healthcheck: test: ["CMD", "curl", "-sf", "http://localhost:8000/health"] interval: 30s timeout: 10s retries: 3 start_period: 180s # gRPC mode (alternative) ocr-grpc: build: context: .. dockerfile: docker/Dockerfile.gpu deploy: resources: reservations: devices: - driver: nvidia count: all capabilities: [gpu] environment: - PIPELINE_POOL_SIZE=5 ports: - "50051:50051" volumes: - trt-cache:/home/ocr/.cache/turbo-ocr command: ["./build/paddle_grpc_server"] restart: unless-stopped profiles: - grpc