Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| # HF Spaces requires a non-root user with uid 1000 | |
| RUN useradd -m -u 1000 user | |
| # System deps for faiss + sentence-transformers | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential libgomp1 curl && \ | |
| rm -rf /var/lib/apt/lists/* | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| PYTHONUNBUFFERED=1 | |
| WORKDIR $HOME/app | |
| # Install CPU-only torch first (avoids downloading the huge CUDA build) | |
| RUN pip install --no-cache-dir --user \ | |
| torch --index-url https://download.pytorch.org/whl/cpu | |
| # Install remaining dependencies | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --user -r requirements.txt | |
| # Copy application code | |
| COPY --chown=user *.py ./ | |
| COPY --chown=user tool_schema.json ./ | |
| # Copy pre-built FAISS index (no Excel files needed at runtime) | |
| COPY --chown=user index_cache/ ./index_cache/ | |
| EXPOSE 8000 | |
| CMD ["python", "main.py"] | |