diff options
author | Runar Borge <runar@borge.nu> | 2019-01-09 13:26:32 +0100 |
---|---|---|
committer | Runar Borge <runar@borge.nu> | 2019-01-09 13:26:32 +0100 |
commit | ed03c43b2a0f7d6d072bab3ae116e1fa0c217375 (patch) | |
tree | fdc1fe0f280cb9548892357f76492346f71aa526 /scripts | |
parent | 88c8b3440bd4e4a31ca86cd5d6e8d23bbc0684e7 (diff) | |
download | vyos-build-ed03c43b2a0f7d6d072bab3ae116e1fa0c217375.tar.gz vyos-build-ed03c43b2a0f7d6d072bab3ae116e1fa0c217375.zip |
Change user on docker image to the current owner of the volume directory (GOSU)
Insted of hardcoding the user used to build inside the container it will now be auto configured to be the user UID that owns the vyos-build directory
This is done with the gosu utillity and a entrypoint script
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/docker-entrypoint.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh new file mode 100755 index 00000000..7520a8d9 --- /dev/null +++ b/scripts/docker-entrypoint.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -e + +# Use GOSU_USER if its specified, else wirking dir user +if [ -n "$GOSU_USER" ]; then + ID=$GOSU_USER +else + ID=$(stat -c "%u:%g" .) +fi + +# Don't use GOSU if we are root +if [ ! "$ID" = "0:0" ]; then + exec gosu $ID "$@" +else + exec "$@" +fi |