FROM python:3.11-slim RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ libgl1 \ libglib2.0-0 \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # Install Python deps system-wide BEFORE switching user so `hf`, `python`, and # every other entrypoint land in /usr/local/bin together. sync.py locates `hf` # via Path(sys.executable).parent / "hf", so they must live in the same dir. COPY indexing/requirements.txt /tmp/requirements.txt RUN pip install --no-cache-dir -r /tmp/requirements.txt \ && pip install --no-cache-dir huggingface_hub RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ HF_HOME=/home/user/.cache/huggingface \ PYTHONUNBUFFERED=1 WORKDIR $HOME/app COPY --chown=user . . EXPOSE 7860 CMD ["python", "backend/server.py", "--host", "0.0.0.0", "--port", "7860"]