Different approach, always create npmuser

even if the user id is zero, and then we'll always use it
This commit is contained in:
Jamie Curnow
2023-03-30 11:19:16 +10:00
parent dad8561ea1
commit 4a86bb42cc
6 changed files with 33 additions and 61 deletions

View File

@ -7,26 +7,15 @@ set -e
cd /app || exit 1
if [ "${DEVELOPMENT:-}" = "true" ]; then
if [ "$PUID" = '0' ]; then
log_info 'Starting backend development ...'
yarn install
node --max_old_space_size=250 --abort_on_uncaught_exception node_modules/nodemon/bin/nodemon.js
else
log_info "Starting backend development as npmuser ($PUID) ..."
s6-setuidgid npmuser yarn install
exec s6-setuidgid npmuser bash -c 'export HOME=/tmp/npmuserhome;node --max_old_space_size=250 --abort_on_uncaught_exception node_modules/nodemon/bin/nodemon.js'
fi
log_info 'Starting backend ...'
if [ "${DEVELOPMENT:-}" = 'true' ]; then
s6-setuidgid npmuser yarn install
exec s6-setuidgid npmuser bash -c 'export HOME=/tmp/npmuserhome;node --max_old_space_size=250 --abort_on_uncaught_exception node_modules/nodemon/bin/nodemon.js'
else
while :
do
if [ "$PUID" = '0' ]; then
log_info 'Starting backend ...'
node --abort_on_uncaught_exception --max_old_space_size=250 index.js
else
log_info "Starting backend as npmuser ($PUID) ..."
s6-setuidgid npmuser bash -c 'export HOME=/tmp/npmuserhome;node --abort_on_uncaught_exception --max_old_space_size=250 index.js'
fi
s6-setuidgid npmuser bash -c 'export HOME=/tmp/npmuserhome;node --abort_on_uncaught_exception --max_old_space_size=250 index.js'
sleep 1
done
fi