fix(docker): make torch/sentence-transformers optional to unblock builds
Some checks failed
CI/CD / go-lint (push) Has been skipped
CI/CD / python-lint (push) Has been skipped
CI/CD / nodejs-lint (push) Has been skipped
CI/CD / test-go-ai-compliance (push) Failing after 34s
CI/CD / test-python-backend-compliance (push) Successful in 34s
CI/CD / test-python-document-crawler (push) Successful in 24s
CI/CD / test-python-dsms-gateway (push) Successful in 18s
CI/CD / validate-canonical-controls (push) Successful in 12s
CI/CD / Deploy (push) Has been skipped
Some checks failed
CI/CD / go-lint (push) Has been skipped
CI/CD / python-lint (push) Has been skipped
CI/CD / nodejs-lint (push) Has been skipped
CI/CD / test-go-ai-compliance (push) Failing after 34s
CI/CD / test-python-backend-compliance (push) Successful in 34s
CI/CD / test-python-document-crawler (push) Successful in 24s
CI/CD / test-python-dsms-gateway (push) Successful in 18s
CI/CD / validate-canonical-controls (push) Successful in 12s
CI/CD / Deploy (push) Has been skipped
Move torch and sentence-transformers to requirements-reranker.txt so the main Docker build succeeds even if these large packages fail to install. The reranker code already handles missing imports gracefully when RERANK_ENABLED=false (the default). This fixes the production deployment — builds were failing because of the ~800MB torch dependency, preventing ALL new code from deploying. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
6
backend-compliance/requirements-reranker.txt
Normal file
6
backend-compliance/requirements-reranker.txt
Normal file
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user