File size: 781 Bytes
bdb156f
0eb0abc
bdb156f
0eb0abc
 
8c7e984
46c2f98
 
 
0eb0abc
 
bdb156f
0eb0abc
 
 
 
bdb156f
0eb0abc
46c2f98
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
FROM python:3.11-slim

WORKDIR /app

# Install deps first (cached layer — only invalidated when requirements change)
COPY requirements-server.txt .
RUN pip install --no-cache-dir \
    torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 && \
    pip install --no-cache-dir -r requirements-server.txt

# Copy source (excludes venv/, training/, assets/, .git/ via .dockerignore)
COPY . .

# Pre-generate facts.json at build time; falls back gracefully if network is down
RUN python -m data.loader || echo "facts.json generation skipped — will use fallback facts"

EXPOSE 7860

# One worker so the optional trained-model adapter is loaded at most once.
CMD ["uvicorn", "environment.server:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]