Skip to content

Commit a11fd20

Browse files
Merge #1065
1065: Workaround for slow CentOS builds depending on the ulimit. r=Emilgardis a=Alexhuszagh Fixes CentOS builds being ~10x slower with certain configurations, where `LimitNOFILE=infinity`. This sets the ulimit for open file descriptors manually, which fixes the issue. See the upstream issue docker/buildx#379. Co-authored-by: Alex Huszagh <[email protected]>
2 parents cfc9a15 + 8331ccd commit a11fd20

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

docker/aarch64-linux-gnu-glibc.sh

+4
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

+7
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

+1
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)