24 lines
574 B
Bash
24 lines
574 B
Bash
|
|
#!/bin/sh
|
||
|
|
set -e
|
||
|
|
|
||
|
|
# Default to PUID 99 and PGID 100 if not specified
|
||
|
|
PUID=${PUID:-99}
|
||
|
|
PGID=${PGID:-100}
|
||
|
|
|
||
|
|
echo "Starting with UID: $PUID, GID: $PGID"
|
||
|
|
|
||
|
|
# Modify the 'node' user and group to match the provided PUID/PGID
|
||
|
|
if [ "$(id -u node)" -ne "$PUID" ]; then
|
||
|
|
usermod -o -u "$PUID" node
|
||
|
|
fi
|
||
|
|
|
||
|
|
if [ "$(id -g node)" -ne "$PGID" ]; then
|
||
|
|
groupmod -o -g "$PGID" node
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Ensure appropriate permissions on the application directory and temp dir
|
||
|
|
chown -R node:node /app
|
||
|
|
|
||
|
|
# Drop privileges to 'node' user and execute the command passed to the container
|
||
|
|
exec su-exec node "$@"
|