From c8c6d237e254234a24b552c518201dff3c7b8c9d Mon Sep 17 00:00:00 2001 From: Kostis Papazafeiropoulos Date: Mon, 8 Jul 2024 19:45:20 +0000 Subject: [PATCH] Get uid/gid from local container fs Get uid/gid from local container fs unless ACTION_UID/ACTION_GID environment variables are explicitly provided Signed-off-by: Kostis Papazafeiropoulos --- entrypoint.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index e187670..66af5bb 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -44,4 +44,7 @@ mc cp -r s3/$remote_path $local_path ok_or_die "Could not fetch object" # Fix owner of local path -chown -R "${ACTION_UID:-root}:${ACTION_GID:-root}" $local_path +LOCAL_UID="${ACTION_UID:-"$(stat -c %u .)"}" +LOCAL_GID="${ACTION_GID:-"$(stat -c %g .)"}" +info "Setting owner/group of $local_path to ${LOCAL_UID:-root}:${LOCAL_GID:-root}" +chown -R "${LOCAL_UID:-root}:${LOCAL_GID:-root}" "$local_path"