diff --git a/build_all.sh b/build_all.sh index 52662678e..4691816ce 100755 --- a/build_all.sh +++ b/build_all.sh @@ -120,3 +120,4 @@ remove_summary_table_file # Cleanup any old containers and images cleanup_images cleanup_manifest +clear_build_cache diff --git a/common_functions.sh b/common_functions.sh index 2dcef8869..6852874af 100755 --- a/common_functions.sh +++ b/common_functions.sh @@ -253,6 +253,19 @@ function cleanup_manifest() { rm -rf ~/.docker/manifests } +function clear_build_cache() { + # Reduce the size of the build cache to avoid exhaustion of the space + docker system df + echo Pruning builder cache to 10Gb + # docker on our arm32 machines gives parse error if bigger than this + if [ "$(uname -m)" = "armv7l" ]; then + SPACE_TO_KEEP=2100000000 + else + SPACE_TO_KEEP=10000000000 + fi + docker builder prune -f --keep-storage ${SPACE_TO_KEEP} +} + # Check if a given docker image exists on the server. # This script errors out if the image does not exist. function check_image() {