From 5a8adc3a8706dc6c64972d95fab4d5c0cbfd995f Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Tue, 26 May 2026 22:54:46 +0000 Subject: [PATCH] ci(docker): retry apk add in Dockerfile.database for apk.cgr.dev flakes Mirror the retry-loop pattern from #28888 (which fixed backend/Dockerfile, gateway/Dockerfile, and migrations/Dockerfile) into docker/Dockerfile.database. The build_docker_database_image CI job has been intermittently failing with "remote server returned error (try 'apk update')" when apk.cgr.dev flakes mid-fetch; bumping the wolfi-base SHA doesn't address the mirror, only a retry does. Same explicit-failure form as #28888: exit non-zero on the 3rd miss instead of silently succeeding because `sleep 5` was the last command in the `&& break || sleep 5` chain. --- docker/Dockerfile.database | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/docker/Dockerfile.database b/docker/Dockerfile.database index bee36348143..32abd7ae63c 100644 --- a/docker/Dockerfile.database +++ b/docker/Dockerfile.database @@ -15,16 +15,20 @@ USER root COPY --from=uvbin /uv /usr/local/bin/uv COPY --from=uvbin /uvx /usr/local/bin/uvx -RUN apk add --no-cache \ - bash \ - gcc \ - python3 \ - python3-dev \ - openssl \ - openssl-dev \ - nodejs \ - npm \ - libsndfile +RUN for i in 1 2 3; do \ + apk add --no-cache \ + bash \ + gcc \ + python3 \ + python3-dev \ + openssl \ + openssl-dev \ + nodejs \ + npm \ + libsndfile && break; \ + [ $i = 3 ] && { echo "apk add failed after 3 retries" >&2; exit 1; }; \ + sleep 5; \ + done ENV UV_PROJECT_ENVIRONMENT=/app/.venv \ UV_LINK_MODE=copy \ @@ -66,7 +70,11 @@ FROM $LITELLM_RUNTIME_IMAGE AS runtime USER root -RUN apk add --no-cache bash openssl tzdata nodejs npm python3 libsndfile && \ +RUN for i in 1 2 3; do \ + apk add --no-cache bash openssl tzdata nodejs npm python3 libsndfile && break; \ + [ $i = 3 ] && { echo "apk add failed after 3 retries" >&2; exit 1; }; \ + sleep 5; \ + done && \ npm install -g npm@11.12.1 tar@7.5.11 glob@11.1.0 @isaacs/brace-expansion@5.0.1 minimatch@10.2.4 diff@8.0.3 && \ GLOBAL="$(npm root -g)" && \ find "$GLOBAL/npm" -type d -name "tar" -path "*/node_modules/tar" | while read d; do \