mlabonne's picture
ColBERT semantic tool selection (LFM2.5)
6d59171
Raw
History Blame Contribute Delete
932 Bytes
# Docker Space: FastAPI backend + static HTML frontend (no Gradio).
# Pinned to the stack the LFM2.5 bidirectional encoder was validated against — its
# remote code (trust_remote_code) is transformers-version sensitive.
FROM python:3.12-slim
# non-root user (HF Spaces convention; writable HOME for the HF cache + tool cache)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
HF_HOME=/home/user/.cache/huggingface \
TOOL_CACHE_DIR=/home/user/app/.tool_cache \
PYTHONUNBUFFERED=1
WORKDIR /home/user/app
# CPU-only torch first (default PyPI wheel is CUDA and huge).
RUN pip install --no-cache-dir --user torch==2.12.0 --index-url https://download.pytorch.org/whl/cpu
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
COPY --chown=user . .
EXPOSE 7860
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]