Spaces:
Sleeping
Sleeping
File size: 856 Bytes
e86dfae | 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 | FROM python:3.11-slim
WORKDIR /app
# Install system deps
RUN apt-get update && apt-get install -y \
libpq-dev \
gcc \
libmagic1 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install PyTorch CPU first (cached layer)
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
# Install requirements
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Pre-download the reranker model during build (no cold start!)
RUN python -c "from sentence_transformers import CrossEncoder; CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')"
# Environment
ENV TOKENIZERS_PARALLELISM=false
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
ENV SENTENCE_TRANSFORMERS_HOME=/app/.cache/sentence-transformers
COPY . .
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|