chore: harden frontend npm ci with retry loop for flaky Nexus proxy

The Nexus npm-group proxy intermittently returns 500s / corrupted
tarballs while back-filling its cache. Wrap npm ci in a 5-attempt retry
loop with raised fetch-retry budget so successive passes converge.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-05-30 05:45:10 +03:30
parent e8c1587695
commit f366d73697
+11 -1
View File
@@ -4,7 +4,17 @@ RUN apk add --no-cache libc6-compat
WORKDIR /app WORKDIR /app
COPY package.json package-lock.json* ./ COPY package.json package-lock.json* ./
RUN npm ci --registry http://171.22.25.73:8081/repository/npm-group/ # The Nexus npm proxy intermittently returns 500s / corrupted tarballs while it
# back-fills its cache from upstream. Retry the whole install a few times — each
# pass re-requests only what's still missing, so successive runs converge once
# Nexus has cached every package. Bump npm's own retry budget too.
RUN for i in 1 2 3 4 5; do \
npm ci --registry http://171.22.25.73:8081/repository/npm-group/ \
--fetch-retries=5 --fetch-retry-factor=2 \
--fetch-retry-mintimeout=20000 --fetch-retry-maxtimeout=120000 && exit 0; \
echo "npm ci attempt $i failed; retrying in 10s..."; sleep 10; \
done; \
echo "npm ci failed after 5 attempts" && exit 1
# ── Stage 2: build ─────────────────────────────────────────────────────────── # ── Stage 2: build ───────────────────────────────────────────────────────────
FROM node:20-alpine AS builder FROM node:20-alpine AS builder