# Use official lightweight Python image FROM python:3.11-slim # Set working directory WORKDIR /app # Copy and install dependencies first (better caching) COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy your app code COPY . . # Expose the port Hugging Face expects (usually 7860, but Flask defaults to 5000 → we override) EXPOSE 7860 # Important: Hugging Face requires the app to listen on 0.0.0.0 and $PORT (usually 7860) # So we override Flask's run command ENV PORT=7860 # Run Flask – important flags! CMD ["python", "app.py"]