-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: more effectively step-down from root in entrypoint
- Loading branch information
1 parent
b249ded
commit ca5de8f
Showing
3 changed files
with
38 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env sh | ||
set -e | ||
|
||
PUID="${PUID:-1000}" | ||
PGID="${PGID:-1000}" | ||
|
||
# Set UID/GID of ansible user | ||
sed -i "s/^ansible\:x\:1000\:1000/ansible\:x\:$PUID\:$PGID/" /etc/passwd | ||
sed -i "s/^ansible\:x\:1000/ansible\:x\:$PGID/" /etc/group | ||
|
||
# Set permissions on home folder, excluding .ssh mount | ||
chown $PUID:$PGID /home/ansible | ||
find /home/ansible -mindepth 1 -maxdepth 1 -not -name ".ssh" -exec chown -R $PUID:$PGID {} \; | ||
|
||
# Step-down from root | ||
exec gosu ansible "${@}" |