Skip to content

Commit ddaf1c6

Browse files
committed
Add rankmirrors for faster builds
1 parent e5f196a commit ddaf1c6

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Dockerfile

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,28 @@ ENV GDB_PORT=1234
117117
ENV GDB=false
118118

119119
WORKDIR /root
120+
121+
ARG RANKMIRRORS=no
122+
ARG MIRROR_COUNTRY=US
123+
ARG MIRROR_COUNT=10
124+
125+
# Arch Linux server mirrors for faster builds
126+
RUN if [[ "${RANKMIRRORS}" = yes ]]; then { pacman -Sy wget --noconfirm || pacman -Syu wget --noconfirm ; } \
127+
; wget -O ./rankmirrors "https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/rankmirrors" \
128+
; wget -O- "https://www.archlinux.org/mirrorlist/?country=${MIRROR_COUNTRY:-US}&protocol=https&use_mirror_status=on" \
129+
| sed -e 's/^#Server/Server/' -e '/^#/d' \
130+
| head -n "$((${MIRROR_COUNT:-10}+1))" \
131+
| bash ./rankmirrors --verbose --max-time 5 - > /etc/pacman.d/mirrorlist \
132+
&& tee -a /etc/pacman.d/mirrorlist <<< 'Server = http://mirrors.evowise.com/archlinux/$repo/os/$arch' \
133+
&& tee -a /etc/pacman.d/mirrorlist <<< 'Server = http://mirror.rackspace.com/archlinux/$repo/os/$arch' \
134+
&& tee -a /etc/pacman.d/mirrorlist <<< 'Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch' \
135+
&& cat /etc/pacman.d/mirrorlist; fi
136+
120137
RUN tee -a /etc/pacman.conf <<< '[community-testing]' \
121138
&& tee -a /etc/pacman.conf <<< 'Include = /etc/pacman.d/mirrorlist'
122139
# RUN tee -a /etc/pacman.conf <<< '[blackarch]' \
123140
# && tee -a /etc/pacman.conf <<< 'Include = /etc/pacman.d/mirrorlist'
124141

125-
RUN tee /etc/pacman.d/mirrorlist <<< 'Server = http://mirror2.totbb.net/archlinux/$repo/os/$arch'
126-
127142
RUN pacman -Syyuu --needed --noconfirm sudo git python3 llvm aarch64-linux-gnu-gcc python-pyasn1 unzip fakeroot \
128143
base-devel go wget make cmake clang flex bison icu fuse linux-headers gcc-multilib lib32-gcc-libs \
129144
pkg-config fontconfig cairo libtiff python2 mesa llvm lld libbsd libxkbfile libxcursor libxext \

0 commit comments

Comments
 (0)