| # Simple CPU-only image | |
| FROM python:3.11-slim | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy app code and model | |
| COPY . . | |
| # Spaces will set PORT (usually 7860) | |
| ENV PORT=7860 \ | |
| MODEL_PATH="model/stroke_pipeline.joblib" | |
| # Bind to $PORT (required by Spaces) | |
| CMD ["sh", "-c", "gunicorn -w 2 -b 0.0.0.0:${PORT} app:app"] | |