# Multi-stage Dockerfile for Hugging Face Spaces # Runs both FastAPI backend and Streamlit frontend FROM python:3.13-slim # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ curl \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Create directories RUN mkdir -p data/chroma data/documents eval/results # Environment variables ENV PYTHONPATH=/app ENV PYTHONUNBUFFERED=1 ENV APP_ENV=production ENV DEBUG=false # Expose port for HF Spaces EXPOSE 7860 # Start script that runs both services COPY start.sh /app/start.sh RUN chmod +x /app/start.sh CMD ["/app/start.sh"]