Skip to content

Commit b8aa537

Browse files
committed
Update pacman mirrorlist fetch with retries and fallback
- Add curl timeouts/retries for mirrorlist download - Keep existing mirrorlist when refresh fails - Prefer HTTPS and mirror status filtering
1 parent 7bf6323 commit b8aa537

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Dockerfile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,22 @@ RUN set -eux; \
2020
-d $DOCKER_USER_HOME -ms /bin/bash $DOCKER_USER
2121
RUN mkdir /application && chown $DOCKER_USER:$DOCKER_USER /application
2222
RUN set -eux; \
23-
curl -fsSL "https://archlinux.org/mirrorlist/?country=${MIRROR_LIST_COUNTRY}&protocol=http&protocol=https&ip_version=4" \
24-
| sed -e 's/^\s*#Server/Server/' -e '/^\s*#/d' \
25-
> /etc/pacman.d/mirrorlist; \
26-
grep -q '^Server' /etc/pacman.d/mirrorlist
23+
tmp="$(mktemp)"; \
24+
if curl -fsSL \
25+
--connect-timeout 10 \
26+
--max-time 30 \
27+
--retry 5 \
28+
--retry-delay 1 \
29+
--retry-all-errors \
30+
"https://archlinux.org/mirrorlist/?country=${MIRROR_LIST_COUNTRY}&protocol=https&ip_version=4&use_mirror_status=on" \
31+
| sed -e 's/^\s*#Server/Server/' -e '/^\s*#/d' \
32+
> "$tmp" \
33+
&& grep -q '^Server' "$tmp"; then \
34+
mv "$tmp" /etc/pacman.d/mirrorlist; \
35+
else \
36+
echo "WARN: mirrorlist update failed; keeping existing /etc/pacman.d/mirrorlist" >&2; \
37+
rm -f "$tmp"; \
38+
fi
2739
RUN pacman -Syu --noconfirm && \
2840
pacman -S --noconfirm --needed $BUILD_PACKAGES && \
2941
pacman -Scc --noconfirm && \

0 commit comments

Comments
 (0)