# Base Python image FROM python:3.10-slim # Environment settings to avoid Python cache & force unbuffered output ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Set working directory WORKDIR /app # Install system dependencies (for building some Python packages) RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ gcc \ g++ \ && rm -rf /var/lib/apt/lists/* # Copy requirements first (better Docker caching) COPY requirements.txt requirements.txt # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt gunicorn # Copy the entire project (including subfolders) COPY . . # Hugging Face Spaces default exposed port EXPOSE 7860 # Run Flask with Gunicorn for parallel processing # app:app means 'app.py' file and 'app' Flask instance inside it CMD ["gunicorn", "--workers", "4", "--threads", "12", "--bind", "0.0.0.0:7860", "app:app"]