feat(infra): parameterize OCR mem_limit via OCR_MEM_LIMIT
Hardcoded `mem_limit: 12g` only works on CX42+ (16 GB) hosts; a CX32 (8 GB) cannot honour it. Make both mem_limit and memswap_limit driven by the OCR_MEM_LIMIT env var, defaulting to 12g so prod deploys on a CX42 keep current behaviour. Operators on smaller hosts override to 6g. Verified compose interpolation produces 12 GiB by default and 6 GiB when OCR_MEM_LIMIT=6g. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -121,8 +121,10 @@ services:
|
||||
- "8000"
|
||||
# Surya OCR loads ~5GB of transformer models at startup; first request
|
||||
# triggers a further ~1GB Kraken model download into ocr-cache.
|
||||
mem_limit: 12g
|
||||
memswap_limit: 12g
|
||||
# CX42+ (16 GB RAM) honours the default. On a CX32 (8 GB) override with
|
||||
# OCR_MEM_LIMIT=6g (slower first-request, fits the host).
|
||||
mem_limit: ${OCR_MEM_LIMIT:-12g}
|
||||
memswap_limit: ${OCR_MEM_LIMIT:-12g}
|
||||
volumes:
|
||||
- ocr-models:/app/models
|
||||
- ocr-cache:/root/.cache
|
||||
|
||||
Reference in New Issue
Block a user