From 31b4fcb9fcf32204d85aea0636e52bb62b887af6 Mon Sep 17 00:00:00 2001 From: GlassedSilver Date: Wed, 4 May 2022 19:58:00 +0200 Subject: [PATCH] We're now using gosu to switch our user down :) --- Dockerfile | 1 + backend/entrypoint.sh | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6922d0b..a6f2838 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,6 +47,7 @@ RUN apt-get update && apt-get -y install \ npm \ python2 \ python3 \ + gosu &\ atomicparsley && \ apt-get install -f && \ apt-get autoremove --purge && \ diff --git a/backend/entrypoint.sh b/backend/entrypoint.sh index b804e66..59ffdb6 100755 --- a/backend/entrypoint.sh +++ b/backend/entrypoint.sh @@ -3,10 +3,15 @@ set -eu CMD="pm2-runtime pm2.config.js" +# if the first arg starts with "-" pass it to program +if [ "${1#-}" != "$1" ]; then + set -- "$CMD" "$@" +fi + # chown current working directory to current user if [ "$*" = "$CMD" ] && [ "$(id -u)" = "0" ]; then find . \! -user "$UID" -exec chown "$UID:$GID" -R '{}' + || echo "WARNING! Could not change directory ownership. If you manage permissions externally this is fine, otherwise you may experience issues when downloading or deleting videos." - su -c "$0" "$(id -un $UID)" "$@" + exec gosu "$UID:$GID" "$0" "$@" fi exec "$@"