2026-01-18 07:33:02 +01:00
|
|
|
# docker-compose.yml - EasyOCR REST API
|
|
|
|
|
# Usage:
|
|
|
|
|
# CPU: docker compose up ocr-cpu
|
|
|
|
|
# GPU: docker compose up ocr-gpu
|
|
|
|
|
#
|
|
|
|
|
# Port: 8002
|
|
|
|
|
|
|
|
|
|
services:
|
|
|
|
|
# CPU-only service
|
|
|
|
|
ocr-cpu:
|
|
|
|
|
image: seryus.ddns.net/unir/easyocr-cpu:latest
|
|
|
|
|
container_name: easyocr-cpu
|
|
|
|
|
ports:
|
|
|
|
|
- "8002:8000"
|
|
|
|
|
volumes:
|
|
|
|
|
- ../dataset:/app/dataset:ro
|
2026-01-18 18:03:23 +01:00
|
|
|
- ../debugset:/app/debugset:rw
|
2026-01-18 07:33:02 +01:00
|
|
|
- easyocr-cache:/root/.EasyOCR
|
|
|
|
|
environment:
|
|
|
|
|
- PYTHONUNBUFFERED=1
|
|
|
|
|
- EASYOCR_LANGUAGES=es,en
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
# GPU service (requires NVIDIA Container Toolkit)
|
|
|
|
|
ocr-gpu:
|
|
|
|
|
image: seryus.ddns.net/unir/easyocr-gpu:latest
|
|
|
|
|
container_name: easyocr-gpu
|
|
|
|
|
ports:
|
|
|
|
|
- "8002:8000"
|
|
|
|
|
volumes:
|
|
|
|
|
- ../dataset:/app/dataset:ro
|
2026-01-18 18:03:23 +01:00
|
|
|
- ../debugset:/app/debugset:rw
|
2026-01-18 07:33:02 +01:00
|
|
|
- easyocr-cache:/root/.EasyOCR
|
|
|
|
|
environment:
|
|
|
|
|
- PYTHONUNBUFFERED=1
|
|
|
|
|
- CUDA_VISIBLE_DEVICES=0
|
|
|
|
|
- EASYOCR_LANGUAGES=es,en
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
|
easyocr-cache:
|
|
|
|
|
name: easyocr-model-cache
|