Skip to content

Commit

Permalink
Update docker-entrypoint.sh with more named pipe fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
V-Shadbolt authored Sep 28, 2024
1 parent 3d148a9 commit 280b4aa
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions images/strapi-debian/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,16 @@ EOT
echo "Starting your app (with ${STRAPI_MODE:-develop})..."

if [ "$GITHUB_ACTIONS" -eq 1 ]; then
pipe="$(mktemp pipe.XXXXXX)"
rm "$pipe" 2>/dev/null
mkfifo "$pipe"
rm -f pipe
mkfifo pipe

if [ -f "yarn.lock" ]; then
yarn "${STRAPI_MODE:-develop}" > pipe & pid=$!
else
npm run "${STRAPI_MODE:-develop}" > pipe & pid=$!
fi

exec 3<"$pipe"
exec 3<pipe
while IFS= read -r line <&3; do
lower_line=$(echo "$line" | tr '[:upper:]' '[:lower:]')
printf '%s\n' "$lower_line"
Expand All @@ -282,15 +281,15 @@ EOT
exec 3<&-
kill "$pid"
echo "Successfully launched Strapi. Exiting container with code 0..."
rm "$pipe" 2>/dev/null
rm -f pipe
exit 0
fi

if [ "${lower_line#*error}" != "$lower_line" ]; then
exec 3<&-
kill "$pid"
echo "Failed to launch Strapi. Exiting container with code 1..."
rm "$pipe" 2>/dev/null
rm -f pipe
exit 1
fi

Expand Down

0 comments on commit 280b4aa

Please sign in to comment.