Skip to content

Commit

Permalink
rake: use docker run -u to avoid chown from root
Browse files Browse the repository at this point in the history
Thanks to @jiimaho for the `-u UID:GID` refinement:
#20
  • Loading branch information
sunaku committed Sep 22, 2024
1 parent 3ff8904 commit 5be0218
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions rake
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ docker images -q "$IMAGE" | grep -q . ||
docker build -t "$IMAGE" -

# run rake(1) inside the image
docker run -v "$PWD:/opt" --rm -it "$IMAGE" \
env CHOWN=$(id -u):$(id -g) \
sh -uc '
rake "$@"
status=$?
find . -user root -exec chown $CHOWN {} \;
exit $status
' _ "$@"
docker run --rm \
-u $(id -u):$(id -g) \
-v "$PWD:/opt" \
-it "$IMAGE" \
rake "$@"

0 comments on commit 5be0218

Please sign in to comment.