Skip to content

Commit

Permalink
Update entrypoint script for Dockerfile to only switch user if its ru…
Browse files Browse the repository at this point in the history
…nning as root

Signed-off-by: Rafael Matias <[email protected]>
  • Loading branch information
skylenet committed Sep 20, 2024
1 parent 19d3ca8 commit a3a1725
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions besu/src/main/scripts/besu-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,10 @@ done
# Construct the command as a single string
COMMAND="/opt/besu/bin/besu $@"

# Switch to the besu user and execute the command
exec su -s /bin/bash $BESU_USER_NAME -c "$COMMAND"
# Check if current user is root
if [ "$(id -u)" -eq 0 ]; then
# Switch to the besu user and execute the command
exec su -s /bin/bash "$BESU_USER_NAME" -c "$COMMAND"
else
exec /bin/bash -c "$COMMAND"
fi

0 comments on commit a3a1725

Please sign in to comment.