FROM python:3.11-slim # Set working directory WORKDIR /app # Copy project files COPY . /app # Install system dependencies (faiss requires libopenblas) RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ libopenblas-dev \ && rm -rf /var/lib/apt/lists/* # Pin numpy version before other deps to avoid faiss compatibility issues RUN pip install --no-cache-dir numpy==1.26.4 # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Expose port (HF Spaces provides $PORT env variable) EXPOSE $PORT # Command to run FastAPI with uvicorn CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port ${PORT:-7860}"]