| FROM python:3.11-slim | |
| # Hugging Face Spaces best practice: run as a non-root user (uid 1000) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /home/user/app | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --user -r requirements.txt | |
| COPY --chown=user . . | |
| # The app reads PORT from the environment; keep it aligned with app_port in README. | |
| ENV PORT=8765 | |
| EXPOSE 8765 | |
| CMD ["python3", "app.py"] | |