# Use lightweight Python base image FROM python:3.10-slim # Prevents Python from writing .pyc files ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ python3-dev \ git \ && rm -rf /var/lib/apt/lists/* # Copy requirements first (for caching) COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the app code COPY . . # Expose port (Hugging Face expects 7860 for Gradio/Flask) EXPOSE 7860 # Run Flask app CMD ["python", "app.py"]