-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (24 loc) · 1.06 KB
/
Copy pathDockerfile
File metadata and controls
34 lines (24 loc) · 1.06 KB
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
FROM python:3.11-slim
# System deps: tesseract for OCR fallback, poppler for pdf2image, build tools for xgboost/faiss wheels
RUN apt-get update && apt-get install -y --no-install-recommends \
tesseract-ocr \
poppler-utils \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# Build the knowledge base indices at image build time so the container
# starts ready-to-serve rather than building indices on first request.
# Falls back to BM25-only automatically if there's no network access to
# download the embedding model at build time — see scripts/build_knowledge_base.py.
RUN python -m scripts.build_knowledge_base || true
# Train the specialist ML risk models at build time (pure synthetic data,
# no network dependency) so trained models ship inside the image.
RUN python -m src.ml.train
RUN mkdir -p /app/data /app/logs
EXPOSE 8000
ENV ENVIRONMENT=production \
PYTHONUNBUFFERED=1
CMD ["uvicorn", "src.api:app", "--host", "0.0.0.0", "--port", "8000"]