From eccb8c7c9863ea8657eb61faa1d91ccda6d7e696 Mon Sep 17 00:00:00 2001 From: Ryan Northey Date: Thu, 12 Apr 2018 18:30:48 +0100 Subject: [PATCH] Dont usermod unless userid is set in docker entrypoint --- docker/base/entrypoint.sh | 13 +++++++------ docker/dev-base/entrypoint.sh | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/docker/base/entrypoint.sh b/docker/base/entrypoint.sh index 4a6c2c8fe13..b1f83e90571 100755 --- a/docker/base/entrypoint.sh +++ b/docker/base/entrypoint.sh @@ -1,12 +1,13 @@ #!/bin/bash -# Add local user -# Either use the LOCAL_USER_ID if passed in at runtime or -# fallback +# If local_user_id is set usermod to this user -USER_ID=${LOCAL_USER_ID:$UID} +POOTLE_ID=$(id -u pootle) + +if [[ ( ! -z ${LOCAL_USER_ID:+x} ) && ( "$LOCAL_USER_ID" != "$POOTLE_ID" ) ]]; then + echo "Starting with UID : $LOCAL_USER_ID"; + usermod -o -u $LOCAL_USER_ID pootle +fi -echo "Starting with UID : $USER_ID" -usermod -o -u $USER_ID pootle export HOME=/home/pootle exec gosu pootle "$@" diff --git a/docker/dev-base/entrypoint.sh b/docker/dev-base/entrypoint.sh index 4a6c2c8fe13..b1f83e90571 100755 --- a/docker/dev-base/entrypoint.sh +++ b/docker/dev-base/entrypoint.sh @@ -1,12 +1,13 @@ #!/bin/bash -# Add local user -# Either use the LOCAL_USER_ID if passed in at runtime or -# fallback +# If local_user_id is set usermod to this user -USER_ID=${LOCAL_USER_ID:$UID} +POOTLE_ID=$(id -u pootle) + +if [[ ( ! -z ${LOCAL_USER_ID:+x} ) && ( "$LOCAL_USER_ID" != "$POOTLE_ID" ) ]]; then + echo "Starting with UID : $LOCAL_USER_ID"; + usermod -o -u $LOCAL_USER_ID pootle +fi -echo "Starting with UID : $USER_ID" -usermod -o -u $USER_ID pootle export HOME=/home/pootle exec gosu pootle "$@"