From ed03c43b2a0f7d6d072bab3ae116e1fa0c217375 Mon Sep 17 00:00:00 2001 From: Runar Borge Date: Wed, 9 Jan 2019 13:26:32 +0100 Subject: 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 --- scripts/docker-entrypoint.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 scripts/docker-entrypoint.sh (limited to 'scripts') 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 -- cgit v1.2.3