| FROM python:3.11-slim | |
| # HF Docker Spaces run as a non-root user by convention; keep it simple and just | |
| # make sure the workdir is writable. | |
| WORKDIR /app | |
| # --- system deps (torch wheel needs none extra on slim, but keep build tools just in case) --- | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # --- python deps first, for layer caching --- | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # --- copy the repo's source files (already using valid underscore module names) --- | |
| COPY corvidae.py . | |
| COPY corvid_extensions.py . | |
| COPY corvid_aviary.py . | |
| COPY species_memory_bank.py . | |
| COPY corvid_eval.py . | |
| COPY app.py . | |
| # HF Docker Spaces expect the app to listen on port 7860 | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| # Run as a non-root user (HF Spaces best practice) | |
| RUN useradd -m -u 1000 appuser | |
| USER appuser | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |