From f366d736978a5ec344df0e86a2b4c8d4f8517d3f Mon Sep 17 00:00:00 2001 From: "soroush.asadi" Date: Sat, 30 May 2026 05:45:10 +0330 Subject: [PATCH] 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 --- Dockerfile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 216b581..3847680 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,17 @@ RUN apk add --no-cache libc6-compat WORKDIR /app 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 ─────────────────────────────────────────────────────────── FROM node:20-alpine AS builder