From 98fed8843b1af68d317ac0fa1eb99dea4d9b276f Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Mon, 8 Apr 2024 10:42:24 -0400 Subject: [PATCH] feat: add support for bypassing gosu in container image Signed-off-by: Devin Buhl --- Dockerfile | 3 ++- start.sh | 18 +++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7a52841f..977f54f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ ARG BRANCH ARG COMMIT ENV TAUTULLI_DOCKER=True +ENV TAUTULLI_DOCKER_GOSU=True ENV TZ=UTC WORKDIR /app @@ -21,8 +22,8 @@ RUN \ touch /config/DOCKER VOLUME /config -CMD [ "python", "Tautulli.py", "--datadir", "/config" ] ENTRYPOINT [ "./start.sh" ] +CMD [ "python", "Tautulli.py", "--datadir", "/config" ] EXPOSE 8181 HEALTHCHECK --start-period=90s CMD curl -ILfSs http://localhost:8181/status > /dev/null || curl -ILfkSs https://localhost:8181/status > /dev/null || exit 1 diff --git a/start.sh b/start.sh index a9970df7..0e7567b4 100755 --- a/start.sh +++ b/start.sh @@ -1,16 +1,20 @@ #!/usr/bin/env bash if [[ "$TAUTULLI_DOCKER" == "True" ]]; then - PUID=${PUID:-1000} - PGID=${PGID:-1000} + if [[ "$TAUTULLI_DOCKER_GOSU" == "True" ]]; then + PUID=${PUID:-1000} + PGID=${PGID:-1000} - groupmod -o -g "$PGID" tautulli - usermod -o -u "$PUID" tautulli + groupmod -o -g "$PGID" tautulli + usermod -o -u "$PUID" tautulli - find /config \! \( -uid $(id -u tautulli) -gid $(id -g tautulli) \) -print0 | xargs -0r chown tautulli:tautulli + find /config \! \( -uid $(id -u tautulli) -gid $(id -g tautulli) \) -print0 | xargs -0r chown tautulli:tautulli - echo "Running Tautulli using user tautulli (uid=$(id -u tautulli)) and group tautulli (gid=$(id -g tautulli))" - exec gosu tautulli "$@" + echo "Running Tautulli using user tautulli (uid=$(id -u tautulli)) and group tautulli (gid=$(id -g tautulli))" + exec gosu tautulli "$@" + else + exec tautulli "$@" + fi else python_versions=("python3.11" "python3.10" "python3.9" "python3.8" "python3" "python") for cmd in "${python_versions[@]}"; do