-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
entrypoint.sh
24 lines (24 loc) · 2.11 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
echo "#################################################################################"
echo "# ██████╗ █████╗ ███╗ ███╗███████╗██╗ ██╗ █████╗ ██╗ ██╗██╗ ████████╗ #"
echo "# ██╔════╝ ██╔══██╗████╗ ████║██╔════╝██║ ██║██╔══██╗██║ ██║██║ ╚══██╔══╝ #"
echo "# ██║ ███╗███████║██╔████╔██║█████╗ ██║ ██║███████║██║ ██║██║ ██║ #"
echo "# ██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ ╚██╗ ██╔╝██╔══██║██║ ██║██║ ██║ #"
echo "# ╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗ ╚████╔╝ ██║ ██║╚██████╔╝███████╗██║ #"
echo "# ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ #"
echo "# developed by Phalcode #"
echo "#################################################################################"
set -e
# If running as root, it means the --user directive for Docker CLI/Compose was not used
# Use then the PUID env to set the user and group IDs
if [ "$(id -u)" = '0' ]; then
# Modify the group ID of the 'node' user to match the PGID environment variable
groupmod -o -g "$PGID" node
# Modify the user ID of the 'node' user to match the PUID environment variable
usermod -o -u "$PUID" node
# Run the specified command with the modified user and group IDs
sudo -u "#$PUID" -g "#$PGID" -E node "${@}"
else
# If using the user directive, run the specified command normally
exec node "${@}"
fi