···11+#!/bin/bash
22+set -e
33+44+# Get current UID/GID from environment or use defaults
55+USER_ID=${PUID:-1000}
66+GROUP_ID=${PGID:-1000}
77+88+echo "Starting with UID: $USER_ID, GID: $GROUP_ID"
99+1010+# Update the user to match desired UID/GID if needed
1111+if [ "$USER_ID" != "1000" ] || [ "$GROUP_ID" != "1000" ]; then
1212+ echo "Updating user 'smallweb' with new UID:GID -> $USER_ID:$GROUP_ID"
1313+ groupmod -g "$GROUP_ID" smallweb
1414+ usermod -u "$USER_ID" -g "$GROUP_ID" smallweb
1515+fi
1616+1717+# Ensure correct ownership of the application directory
1818+chown -R smallweb:smallweb /smallweb
1919+2020+# Execute the command as the smallweb user
2121+exec gosu smallweb:smallweb /usr/local/bin/smallweb "$@"