From 4eb5eba3478297189903f32355259f4b842e0757 Mon Sep 17 00:00:00 2001 From: Marcel Date: Mon, 11 May 2026 12:01:23 +0200 Subject: [PATCH] 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 --- docker-compose.prod.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 71634b76..56f73689 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -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