Skip to content

Commit

Permalink
Get uid/gid from local container fs
Browse files Browse the repository at this point in the history
Get uid/gid from local container fs unless ACTION_UID/ACTION_GID
environment variables are explicitly provided

Signed-off-by: Kostis Papazafeiropoulos <[email protected]>
  • Loading branch information
papazof committed Jul 10, 2024
1 parent ef4e94a commit 50446a9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,12 @@ 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
if [ -n "${ACTION_UID}"] && [ -n "${ACTION_GID}"]; then
LOCAL_UID="${ACTION_UID}"
LOCAL_GID="${ACTION_GID}"
else
LOCAL_UID="$(stat -c %u .)"
LOCAL_GID="$(stat -c %g .)"
fi
info "Setting owner/group of $local_path to ${LOCAL_UID:-root}:${LOCAL_GID:-root}"
chown -R "${LOCAL_UID:-root}:${LOCAL_GID:-root}" $local_path

0 comments on commit 50446a9

Please sign in to comment.