diff --git a/Dockerfile b/Dockerfile index fb87968a1..47ab8f2da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -250,9 +250,15 @@ ENTRYPOINT ["./entrypoint.sh"] # Final image FROM base -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/" -ENTRYPOINT ["/tgi-entrypoint.sh"] -# CMD ["--json-output"] +ENV UID=1000 +ENV USER=llm +RUN groupadd -g "${UID}" "${USER}" && useradd -m -u "${UID}" -g "${USER}" "${USER}" +# Give access to users to `/root/.local` where the python interpreter is located (since it was installed as root by uv). +RUN chmod 555 /root +USER ${USER} +WORKDIR /home/${USER} +RUN mkdir -p -m 0744 /home/${USER}/cache +COPY --chown=${USER}:${USER} ./tgi-entrypoint.sh tgi-entrypoint.sh +RUN chmod +x tgi-entrypoint.sh +ENTRYPOINT ["./tgi-entrypoint.sh"] diff --git a/tgi-entrypoint.sh b/tgi-entrypoint.sh index cd551ed5e..32eccea55 100755 --- a/tgi-entrypoint.sh +++ b/tgi-entrypoint.sh @@ -2,5 +2,5 @@ ldconfig 2>/dev/null || echo 'unable to refresh ld cache, not a big deal in most cases' -source ./.venv/bin/activate +source /usr/src/.venv/bin/activate exec text-generation-launcher $@