diff --git a/backend-compliance/Dockerfile b/backend-compliance/Dockerfile index fa9ce0a..66cc5a3 100644 --- a/backend-compliance/Dockerfile +++ b/backend-compliance/Dockerfile @@ -10,13 +10,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching -COPY requirements.txt . +COPY requirements.txt requirements-reranker.txt ./ # Create virtual environment and install dependencies RUN python -m venv /opt/venv ENV PATH="/opt/venv/bin:$PATH" RUN pip install --no-cache-dir --upgrade pip && \ - pip install --no-cache-dir -r requirements.txt + pip install --no-cache-dir -r requirements.txt && \ + pip install --no-cache-dir -r requirements-reranker.txt || \ + echo "WARNING: reranker dependencies not installed (torch/sentence-transformers)" # ---- Runtime stage ---- FROM python:3.12-slim-bookworm diff --git a/backend-compliance/requirements-reranker.txt b/backend-compliance/requirements-reranker.txt new file mode 100644 index 0000000..6ab3732 --- /dev/null +++ b/backend-compliance/requirements-reranker.txt @@ -0,0 +1,6 @@ +# Optional: Cross-Encoder Re-Ranking (CPU-only PyTorch) +# Install separately: pip install -r requirements-reranker.txt +# Enable at runtime: RERANK_ENABLED=true +--extra-index-url https://download.pytorch.org/whl/cpu +torch +sentence-transformers>=3.0.0 diff --git a/backend-compliance/requirements.txt b/backend-compliance/requirements.txt index 65cf061..2a11dde 100644 --- a/backend-compliance/requirements.txt +++ b/backend-compliance/requirements.txt @@ -22,10 +22,7 @@ python-multipart>=0.0.22 # AI / Anthropic (compliance AI assistant) anthropic==0.75.0 -# Re-Ranking (cross-encoder, CPU-only PyTorch to keep image small) ---extra-index-url https://download.pytorch.org/whl/cpu -torch -sentence-transformers>=3.0.0 +# Re-Ranking: see requirements-reranker.txt (optional, CPU-only PyTorch) # PDF Generation (GDPR export, audit reports) weasyprint>=68.0