| # ββ Base image ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| FROM python:3.11-slim | |
| # ββ System deps βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| git curl ca-certificates ffmpeg libmagic1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # ββ Non-root user required by Hugging Face Spaces βββββββββββββββββββββββββββββ | |
| RUN useradd -m -u 1000 cow | |
| WORKDIR /app | |
| # ββ Clone CowAgent source βββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| RUN git clone --depth=1 https://github.com/zhayujie/CowAgent.git /app | |
| # ββ Python deps βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| COPY requirements-hf.txt /app/requirements-hf.txt | |
| RUN pip install --no-cache-dir -r /app/requirements-hf.txt | |
| # ββ Entrypoint, config & CSS patches ββββββββββββββββββββββββββββββββββββββββββ | |
| COPY entrypoint.sh /app/entrypoint.sh | |
| COPY mobile-fix.css /app/mobile-fix.css | |
| RUN chmod +x /app/entrypoint.sh | |
| # HF Spaces persists /data across restarts | |
| RUN mkdir -p /data/cow && chown -R cow:cow /data /app | |
| USER cow | |
| # HF Spaces always uses port 7860 | |
| EXPOSE 7860 | |
| CMD ["/app/entrypoint.sh"] | |