Skip to content

Commit 8331ccd

Browse files
committed
Workaround for slow CentOS builds depending on the ulimit.
1 parent 62b8a69 commit 8331ccd

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

docker/aarch64-linux-gnu-glibc.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
set -x
44
set -euo pipefail
55

6+
# shellcheck disable=SC1091
7+
. lib.sh
8+
69
unpack_rpm() {
710
local package="${1}"
811
curl --retry 3 "http://mirror.centos.org/altarch/7/os/aarch64/Packages/${package}" -O
@@ -35,6 +38,7 @@ cp_gcc_archive() {
3538
}
3639

3740
main() {
41+
set_centos_ulimit
3842
yum install -y epel-release
3943
yum install -y gcc-aarch64-linux-gnu gcc-c++-aarch64-linux-gnu binutils-aarch64-linux-gnu binutils gcc-c++ glibc-devel
4044
yum clean all

docker/lib.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44
purge_list=()
55

6+
set_centos_ulimit() {
7+
# this is a bug affecting buildkit with yum when ulimit is unlimited
8+
# https://github.com/docker/buildx/issues/379#issuecomment-1196517905
9+
ulimit -n 1024000
10+
}
11+
612
install_packages() {
713
if grep -i ubuntu /etc/os-release; then
814
apt-get update
@@ -15,6 +21,7 @@ install_packages() {
1521
fi
1622
done
1723
else
24+
set_centos_ulimit
1825
for pkg in "${@}"; do
1926
if ! yum list installed "${pkg}" >/dev/null 2>/dev/null; then
2027
yum install -y "${pkg}"

docker/qemu.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ build_static_libattr() {
5454

5555
pushd "${td}"
5656

57+
set_centos_ulimit
5758
yum install -y gettext
5859

5960
curl --retry 3 -sSfL "https://download.savannah.nongnu.org/releases/attr/attr-${version}.src.tar.gz" -O

0 commit comments

Comments
 (0)