Jupyter / Dockerfile
SmartDataAlex's picture
Deploy vectorization service from GitHub 270d0d79c8e2b0ece4aa77f00be514a5d6f4ce2d
ba8d0f9 verified
Raw History Blame Contribute Delete
1.4 kB
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"]