From 5ca50bcfa213dbdfef0be16e71d6e897ca1c1c5e Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Mon, 31 Aug 2026 12:44:46 +0200 Subject: [PATCH] fix: workdir switching for node containers --- node/base/entrypoint.sh | 19 ++++++++++++++++++- node/npm/entrypoint.sh | 8 ++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/node/base/entrypoint.sh b/node/base/entrypoint.sh index 625c948..653e9df 100644 --- a/node/base/entrypoint.sh +++ b/node/base/entrypoint.sh @@ -2,8 +2,25 @@ set -e +echo " +Setting workdir from current dir, which is $(pwd) +" +if [ -n "$2" ]; then + cd "./$2" +fi + echo " Running node script $1 " -node $1 >/tmp/log.txt +node $1 >/tmp/log.txt || command_failed=1 + +if [ ${command_failed:-0} -eq 1 ]; then + cat /tmp/log.txt + echo " +==> Command has failed. See log above + " + exit 1 +else + echo "Compile successful, log omitted" +fi diff --git a/node/npm/entrypoint.sh b/node/npm/entrypoint.sh index f28601b..e932623 100644 --- a/node/npm/entrypoint.sh +++ b/node/npm/entrypoint.sh @@ -20,19 +20,19 @@ echo " Setting workdir from current dir, which is $(pwd) " if [ -n "$WORKDIR" ]; then - cd "$WORKDIR" + cd "./$WORKDIR" fi echo " Running npm command " -npm run $NPM_CMD >/tmp/log.txt || compile_fail=1 +npm run $NPM_CMD >/tmp/log.txt || command_fail=1 -if [ ${compile_fail:-0} -eq 1 ]; then +if [ ${command_fail:-0} -eq 1 ]; then cat /tmp/log.txt echo " -==> Compile has failed. See log above +==> Command has failed. See log above " exit 1 else