From 5a5a51217e0db19a1b437cef3fb713608500625a Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Thu, 6 Mar 2025 16:45:55 +0100 Subject: [PATCH] Stop being root in the docker. --- Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Dockerfile b/Dockerfile index fb87968a..4aa0ef3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -254,5 +254,14 @@ COPY ./tgi-entrypoint.sh /tgi-entrypoint.sh RUN chmod +x /tgi-entrypoint.sh ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/root/.local/share/uv/python/cpython-3.11.11-linux-x86_64-gnu/lib/" +ENV UID=1000 +ENV USER=llm +RUN groupadd -g "${UID}" "${USER}" && useradd -m -u "${UID}" -g "${USER}" "${USER}" +# Switch to non-root user and use their home as workdir +RUN mkdir /data +RUN chown -R ${USER}:${USER} /data +USER ${USER} +WORKDIR /home/${USER} +ENV HF_HOME=/home/${USER}/cache ENTRYPOINT ["/tgi-entrypoint.sh"] # CMD ["--json-output"]