| FROM python:3.11-slim | |
| # Runtime libs for numpy/scipy/sklearn wheels on Debian trixie | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libgomp1 \ | |
| libgfortran5 \ | |
| libopenblas0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Install Python deps first for better caching | |
| COPY requirements.txt /app/ | |
| RUN pip install --no-cache-dir --upgrade pip \ | |
| && pip install --no-cache-dir -r requirements.txt | |
| # Copy app code | |
| COPY . /app | |
| # Hugging Face sets $PORT; default helps local dev | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| # Bind gunicorn to $PORT so Spaces health-checks pass | |
| CMD ["bash", "-lc", "gunicorn app:app --bind 0.0.0.0:${PORT} --workers 1 --threads 2 --timeout 120 --log-level info"] | |