62 lines
1.6 KiB
YAML
62 lines
1.6 KiB
YAML
|
|
# docker-compose.yml - DocTR REST API
|
||
|
|
# Usage:
|
||
|
|
# CPU: docker compose up ocr-cpu
|
||
|
|
# GPU: docker compose up ocr-gpu
|
||
|
|
#
|
||
|
|
# Port: 8003
|
||
|
|
|
||
|
|
services:
|
||
|
|
# CPU-only service
|
||
|
|
ocr-cpu:
|
||
|
|
image: seryus.ddns.net/unir/doctr-cpu:latest
|
||
|
|
container_name: doctr-cpu
|
||
|
|
ports:
|
||
|
|
- "8003:8000"
|
||
|
|
volumes:
|
||
|
|
- ../dataset:/app/dataset:ro
|
||
|
|
- doctr-cache:/root/.cache/doctr
|
||
|
|
environment:
|
||
|
|
- PYTHONUNBUFFERED=1
|
||
|
|
- DOCTR_DET_ARCH=db_resnet50
|
||
|
|
- DOCTR_RECO_ARCH=crnn_vgg16_bn
|
||
|
|
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: 180s
|
||
|
|
|
||
|
|
# GPU service (requires NVIDIA Container Toolkit)
|
||
|
|
ocr-gpu:
|
||
|
|
image: seryus.ddns.net/unir/doctr-gpu:latest
|
||
|
|
container_name: doctr-gpu
|
||
|
|
ports:
|
||
|
|
- "8003:8000"
|
||
|
|
volumes:
|
||
|
|
- ../dataset:/app/dataset:ro
|
||
|
|
- doctr-cache:/root/.cache/doctr
|
||
|
|
environment:
|
||
|
|
- PYTHONUNBUFFERED=1
|
||
|
|
- CUDA_VISIBLE_DEVICES=0
|
||
|
|
- DOCTR_DET_ARCH=db_resnet50
|
||
|
|
- DOCTR_RECO_ARCH=crnn_vgg16_bn
|
||
|
|
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: 180s
|
||
|
|
|
||
|
|
volumes:
|
||
|
|
doctr-cache:
|
||
|
|
name: doctr-model-cache
|