FROM python:3.11-slim WORKDIR /code # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ curl \ software-properties-common \ git \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy application code COPY . . # Create non-root user for security RUN useradd -m -u 1000 user USER user # Set environment variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONPATH=/code # Expose port for Hugging Face Spaces EXPOSE 7860 # Start the application CMD ["python", "app.py"]