nginx-proxy-manager-zh/docker/rootfs/etc/s6-overlay/s6-rc.d/backend/run

33 lines
972 B
Plaintext
Raw Normal View History

#!/command/with-contenv bash
# shellcheck shell=bash
set -e
. /bin/common.sh
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
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
sleep 1
done
fi