Stop being root in the docker.

This commit is contained in:
Nicolas Patry 2025-03-06 16:45:55 +01:00
parent 8e92942a18
commit 5a5a51217e
No known key found for this signature in database
GPG Key ID: 4242CEF24CB6DBF9

View File

@ -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"]