Files
docker/node/npm/entrypoint.sh
T
2026-04-03 15:45:17 +02:00

41 lines
537 B
Bash

#!/bin/sh
set -e
NPM_CMD="$1"
WORKDIR="$2"
FULL_PKG="$3"
if [ -n "$FULL_PKG" ]; then
if [ "$FULL_PKG" == "true" ]; then
npm i
else
npm i --omit=dev
fi
else
npm i --omit=dev
fi
echo "
Setting workdir from current dir, which is $(pwd)
"
if [ -n "$WORKDIR" ]; then
cd "$WORKDIR"
fi
echo "
Running npm command
"
npm run $NPM_CMD >/tmp/log.txt || compile_fail=1
if [ ${compile_fail:-0} -eq 1 ]; then
cat /tmp/log.txt
echo "
==> Compile has failed. See log above
"
exit 1
else
echo "Compile successful, log omitted"
fi