File size: 1,402 Bytes
4a5af54
 
 
 
 
d289270
 
ba8d0f9
 
 
d289270
 
 
 
4a5af54
 
7dce25f
d289270
 
4a5af54
 
d289270
 
4a5af54
 
 
 
d289270
 
 
4a5af54
 
 
 
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
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    E5_MODEL_DIR=/opt/models/multilingual-e5-small \
    QWEN_MODEL_DIR=/opt/models/qwen3-embedding-0.6b \
    COLBERT_MODEL_DIR=/opt/models/mlateon \
    BGE_M3_MODEL_DIR=/opt/models/bge-m3 \
    BGE_M3_ENABLED=1 \
    BGE_M3_MAX_TOKENS=2048 \
    MEMORY_BUDGET_MB=15360 \
    CPU_THREADS=2 \
    OMP_NUM_THREADS=2 \
    TOKENIZERS_PARALLELISM=false
WORKDIR /service
RUN apt-get update && apt-get install -y --no-install-recommends libgomp1 \
    && rm -rf /var/lib/apt/lists/*
RUN pip install --no-cache-dir torch==2.8.0 --index-url https://download.pytorch.org/whl/cpu
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY scripts/download_model.py ./scripts/download_model.py
COPY scripts/bench_local.py ./scripts/bench_local.py
COPY scripts/preflight_colbert.py ./scripts/preflight_colbert.py
RUN python scripts/download_model.py
COPY app ./app
COPY VERSION ./VERSION
ENV HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1
# Run actual PyLate initialization and query/document inference at image-build
# time: reject incompatible checkpoints before deploying to the live Space.
RUN python -m scripts.preflight_colbert
RUN useradd --uid 1000 --create-home appuser
USER appuser
EXPOSE 7860
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]