Skip to content

Commit c6b59b0

Browse files
committed
backend/Dockerfile: retry apt-get on transient mirror 404s
deb.debian.org is a CDN in front of many mirror origins; a -security point-release rotation can leave one edge's index listing a filename another edge has already purged, producing a 404 an apt-get install can't recover from mid-run. Wrapping update+install in a retry loop lets a fresh apt-get update (which usually lands on a consistent edge) resolve it within the same build, instead of needing a whole CI job rerun. Verified live: this branch's AWS Preview workflow hit this exact failure 3 times in a row on 3 different packages (libtiff, libc-l10n, libperl); reproduced locally against the unmodified Dockerfile (libde265-0, arm64) while testing the fix. Confirmed the retry loop itself works (recovered from the same live mirror flakiness during a local arm64 build) and that the full build succeeds end-to-end on linux/amd64 (the real CI architecture) with the fix applied. No deploy-api.yml failure has ever been caused by this — checked its last ~30 runs; its only 2 failures were unrelated migration-task issues, apt-get succeeded in both. Folding this into #723 rather than a separate PR so the fix gets verified through this branch's own preview deploy, which is already hitting the failure live.
1 parent cf5ed61 commit c6b59b0

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

backend/Dockerfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@ ENV PYTHONUNBUFFERED=True
66
ENV APP_HOME=/app
77
WORKDIR $APP_HOME
88

9-
RUN apt-get update && \
10-
apt-get install -y openssh-client libpq-dev postgresql libpq-dev gdal-bin libgdal-dev && \
9+
# Retries apt-get update+install a few times: deb.debian.org is a CDN in
10+
# front of many mirror origins, and a -security point-release rotation can
11+
# leave one edge's index listing a filename another edge has already
12+
# purged, producing a 404 that a fresh apt-get update usually resolves on
13+
# the next attempt (seen live: PR #723's preview build, 2026-09-04).
14+
RUN for i in 1 2 3 4 5; do \
15+
apt-get update && \
16+
apt-get install -y openssh-client libpq-dev postgresql libpq-dev gdal-bin libgdal-dev \
17+
&& break || { echo "apt-get attempt $i failed, retrying..."; sleep 10; }; \
18+
done && \
1119
apt-get clean && \
1220
rm -rf /var/lib/apt/lists/*
1321

0 commit comments

Comments
 (0)