fix: install piper-tts as root (venv is root-owned in base image)

The nousresearch/hermes-agent:latest image creates its venv
as root. Running 'uv pip install' as USER hermes fails with
Permission denied on the site-packages directory.

Fix: keep USER root while modifying the venv, then switch
back to USER hermes for runtime.
This commit is contained in:
Thierry Pouplier
2026-05-09 17:47:30 +00:00
parent 6f17743667
commit 3f80744ebd

View File

@@ -19,12 +19,8 @@ COPY --chmod=0755 --from=uv_source /uv /usr/local/bin/
WORKDIR /opt/hermes WORKDIR /opt/hermes
# ---------- Hermes venv ----------
USER hermes
# ---------- Piper TTS dans le venv existant ---------- # ---------- Piper TTS dans le venv existant ----------
# Le venv existe déjà dans l'image de base (hermes-agent installé). # Le venv de l'image de base est root-owned, on doit installer en root aussi
# On ajoute simplement Piper et ses dépendences.
RUN . /opt/hermes/.venv/bin/activate && \ RUN . /opt/hermes/.venv/bin/activate && \
uv pip install --no-cache-dir piper-tts sounddevice numpy uv pip install --no-cache-dir piper-tts sounddevice numpy
@@ -45,6 +41,9 @@ COPY patch_tts_tool.py /tmp/patch_tts_tool.py
RUN /opt/hermes/.venv/bin/python3 /tmp/patch_tts_tool.py && rm /tmp/patch_tts_tool.py RUN /opt/hermes/.venv/bin/python3 /tmp/patch_tts_tool.py && rm /tmp/patch_tts_tool.py
# ---------- Runtime ---------- # ---------- Runtime ----------
# Retour à l'utilisateur non-root pour la sécurité
USER hermes
ENV HERMES_HOME=/opt/data ENV HERMES_HOME=/opt/data
ENV PATH="/opt/data/.local/bin:${PATH}" ENV PATH="/opt/data/.local/bin:${PATH}"