File size: 1,758 Bytes
bbc1789
 
 
 
700284c
 
bbc1789
 
 
 
 
 
 
 
 
360b154
bbc1789
 
 
360b154
 
bbc1789
 
 
700284c
e6ea3c1
 
700284c
 
bbc1789
 
 
 
360b154
e6ea3c1
 
360b154
bbc1789
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360b154
bbc1789
 
 
700284c
360b154
bbc1789
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# ======================================================
# Savant RRF Φ12.5 — Optimized Dockerfile
# ======================================================

FROM python:3.11-slim

# --------------------------
# ENV optimizations
# --------------------------
ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    HF_HOME=/cache/huggingface \
    TRANSFORMERS_CACHE=/cache/huggingface \
    SENTENCE_TRANSFORMERS_HOME=/cache/huggingface

# --------------------------
# Workdir
# --------------------------
WORKDIR /app

# --------------------------
# System deps (minimal)
# --------------------------
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    git \
    && rm -rf /var/lib/apt/lists/*

# --------------------------
# Install Python deps (cache-friendly)
# --------------------------
COPY requirements.txt .

RUN pip install --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# --------------------------
# Preload models (CRITICAL for cold start)
# --------------------------
RUN python - <<EOF
from sentence_transformers import SentenceTransformer
from huggingface_hub import hf_hub_download

# preload embedder
SentenceTransformer("antonypamo/RRFSAVANTMADE")

# preload meta-logit
hf_hub_download(
    repo_id="antonypamo/RRFSavantMetaLogicV2",
    filename="logreg_rrf_savant.joblib"
)
EOF

# --------------------------
# Copy app (AFTER deps for cache)
# --------------------------
COPY app.py .

# --------------------------
# Expose port
# --------------------------
EXPOSE 7860

# --------------------------
# Start server (optimized)
# --------------------------
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]