node/docker-entrypoint.sh

23 lines
455 B
Bash
Executable file

#!/usr/bin/env bash
IP=$( hostname -i )
if [[ -z "$@" ]]
then
if [[ -f "package.json" ]]
then
PACKAGE_JSON_START=$( cat package.json | jq -r '.scripts.start // empty' )
if [[ -z "$PACKAGE_JSON_START" ]]
then
echo "package.json found, but no start script, starting bash..."
exec bash
else
exec $PACKAGE_JSON_START
fi
else
echo "No package.json found, starting bash..."
exec bash
fi
else
exec $@
fi