fix(docker): fail node-deps build if npm install exhausts all retries

The retry loop exited with sleep's exit code (0) after all 5 attempts,
letting Docker commit an empty /app/node_modules layer. Added explicit
exit 1 on the final failed attempt so the build fails visibly instead
of producing a broken base image that downstream COPY --from cannot find.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 21:38:31 +00:00
parent 882c637a06
commit 452ea7a785

View File

@@ -56,9 +56,9 @@ RUN npm config set fetch-retries 5 \
&& npm config set fetch-retry-mintimeout 20000 \
&& npm config set maxsockets 5 \
&& for i in 1 2 3 4 5; do \
npm install 2>&1 \
&& break \
|| (echo "npm install failed (attempt $i/5), retrying in $((i*10))s..." && sleep $((i*10))); \
npm install 2>&1 && break; \
[ "$i" = "5" ] && echo "npm install failed after 5 attempts" && exit 1; \
echo "npm install failed (attempt $i/5), retrying in $((i*10))s..." && sleep $((i*10)); \
done
# Pre-install Next.js SWC binaries (avoids unreliable CDN download during