Skip to content

Commit

Permalink
Merge #1065
Browse files Browse the repository at this point in the history
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 <ahuszagh@gmail.com>
  • Loading branch information
bors[bot] and Alexhuszagh authored Oct 8, 2022
2 parents 1e5c3ca + 9d480ea commit b6fb1df
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions docker/aarch64-linux-gnu-glibc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ cp_gcc_archive() {
}

main() {
set_centos_ulimit
yum install -y epel-release
yum install -y gcc-aarch64-linux-gnu gcc-c++-aarch64-linux-gnu binutils-aarch64-linux-gnu binutils gcc-c++ glibc-devel
yum clean all
Expand Down
7 changes: 7 additions & 0 deletions docker/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

purge_list=()

set_centos_ulimit() {
# this is a bug affecting buildkit with yum when ulimit is unlimited
# https://github.com/docker/buildx/issues/379#issuecomment-1196517905
ulimit -n 1024000
}

install_packages() {
if grep -i ubuntu /etc/os-release; then
apt-get update
Expand All @@ -15,6 +21,7 @@ install_packages() {
fi
done
else
set_centos_ulimit
for pkg in "${@}"; do
if ! yum list installed "${pkg}" >/dev/null 2>/dev/null; then
yum install -y "${pkg}"
Expand Down
1 change: 1 addition & 0 deletions docker/qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ build_static_libattr() {

pushd "${td}"

set_centos_ulimit
yum install -y gettext

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

0 comments on commit b6fb1df

Please sign in to comment.