diff --git a/Dockerfile b/Dockerfile index d30dc3be..f82e7551 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,13 +11,16 @@ ENV TZ=UTC WORKDIR /app RUN \ + groupadd -g 1000 tautulli && \ + useradd -u 1000 -g 1000 tautulli && \ echo ${BRANCH} > /app/branch.txt && \ echo ${COMMIT} > /app/version.txt COPY . /app +CMD [ "python", "Tautulli.py", "--datadir", "/config" ] ENTRYPOINT [ "./start.sh" ] VOLUME /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 +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 a1fabe15..6af76da3 100755 --- a/start.sh +++ b/start.sh @@ -1,21 +1,16 @@ #!/usr/bin/env bash if [[ "$TAUTULLI_DOCKER" == "True" ]]; then - if [[ -n $PUID && -n $PGID ]]; then - getent group "$PGID" 2>&1 > /dev/null || groupadd -g "$PGID" tautulli - getent passwd "$PUID" 2>&1 > /dev/null || useradd -r -u "$PUID" -g "$PGID" tautulli + PUID=${PUID:-1000} + PGID=${PGID:-1000} - user=$(getent passwd "$PUID" | cut -d: -f1) - group=$(getent group "$PGID" | cut -d: -f1) - usermod -a -G root "$user" + groupmod -o -g $PGID tautulli + usermod -o -u $PUID tautulli - chown -R "$user":"$group" /config + chown -R tautulli:tautulli /config - echo "Running Tautulli using user $user (uid=$PUID) and group $group (gid=$PGID)" - su "$user" -g "$group" -c "python /app/Tautulli.py --datadir /config" - else - python Tautulli.py --datadir /config - fi + echo "Running Tautulli using user tautulli (uid=$(id -u tautulli)) and group tautulli (gid=$(id -g tautulli))" + exec gosu tautulli "$@" else python_versions=("python3" "python3.8" "python3.7" "python3.6" "python" "python2" "python2.7") for cmd in "${python_versions[@]}"; do