The only actual change is falling back to uid 1000 if stat finds uid 0 on the mounted filesystem.
# change the app user's uid:gid to match the repo root directory's
uid=$(stat -c "%u" .)
if [[ "${uid}" == "0" ]]; then
# Never run as root even if directory is owned by root.
# Fall back to 1000 which we know is the app user
uid=1000
fi
run_user="node"
usermod --uid "${uid}" --non-unique "${run_user}" |& grep -v "no changes" || true
The only actual change is falling back to uid 1000 if stat finds uid 0 on the mounted filesystem.