FROM python:3.11-slim # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender-dev \ libgomp1 \ && 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 . . # Hugging Face Spaces runs as non-root user 1000 RUN useradd -m -u 1000 user USER user # Expose port 7860 (required by Hugging Face Spaces) EXPOSE 7860 # Start the FastAPI app on port 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]