File size: 940 Bytes
18ab7fd 2833d32 18ab7fd 2833d32 18ab7fd 2833d32 18ab7fd 2833d32 ee87e4d 18ab7fd 2833d32 ee87e4d 283c442 ee87e4d 2833d32 | 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
WORKDIR /app
# Install system dependencies including git-lfs
RUN apt-get update && apt-get install -y \
build-essential \
git \
git-lfs \
&& rm -rf /var/lib/apt/lists/* \
&& git lfs install
# Copy requirements first for caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code (LFS files are automatically handled by HF)
COPY . .
# Verify vectorstore files exist
RUN ls -la vectorstore/ && python -c "import faiss; idx = faiss.read_index('vectorstore/faiss_index.bin'); print(f'FAISS index loaded: {idx.ntotal} vectors')"
# Expose port for HuggingFace Spaces
EXPOSE 7860
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV HF_HOME=/tmp/huggingface
ENV TRANSFORMERS_CACHE=/tmp/huggingface
ENV SENTENCE_TRANSFORMERS_HOME=/tmp/huggingface
# Run with gunicorn
CMD ["gunicorn", "-b", "0.0.0.0:7860", "-w", "1", "--timeout", "300", "app:app"]
|