entrypoint
674 Bytes
#!/bin/bash
set -ex
node_home="$(getent passwd node | cut -f 6 -d :)"
if [[ $GID && $GID -ne 0 ]]; then
groupmod -g $GID node
fi
if [[ $UID && $UID -ne 0 ]]; then
usermod -u $UID node
fi
find "$node_home" \
'(' -not -user node -a -not -group node -exec chown node:node '{}' + ')' -o \
'(' -not -user node -exec chown node '{}' + ')' -o \
'(' -not -group node -exec chgrp node '{}' + ')' -o \
-true
npm -g config set http_proxy "$http_proxy"
npm -g config set https_proxy "$http_proxy"
sudo -u node npm config set http_proxy "$http_proxy"
sudo -u node npm config set https_proxy "$http_proxy"
if [[ -e package.json ]]; then
sudo -u node npm install
fi
exec "$@"