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 8, 2024
1 parent a3a0342 commit a74defb
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 @@ -45,4 +45,12 @@ mc find s3/$remote_path --name "*" --exec "mc cp {} $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
chown -R "${LOCAL_UID:-root}:${LOCAL_GID:-root}" $local_path

0 comments on commit a74defb

Please sign in to comment.