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 e39c024
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,14 @@ 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}"
echo "UID: $LOCAL_UID"
else
LOCAL_UID="$(stat -c %u .)"
LOCAL_GID="$(stat -c %g .)"
echo "UID(stat): $LOCAL_UID"
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 e39c024

Please sign in to comment.