Skip to content

Commit e499808

Browse files
authored
Merge pull request #630 from sxa/purge_cache
Prune build cache after creating images
2 parents cf9a794 + 0fd4216 commit e499808

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

build_all.sh

+1
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,4 @@ remove_summary_table_file
120120
# Cleanup any old containers and images
121121
cleanup_images
122122
cleanup_manifest
123+
clear_build_cache

common_functions.sh

+13
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,19 @@ function cleanup_manifest() {
253253
rm -rf ~/.docker/manifests
254254
}
255255

256+
function clear_build_cache() {
257+
# Reduce the size of the build cache to avoid exhaustion of the space
258+
docker system df
259+
echo Pruning builder cache to 10Gb
260+
# docker on our arm32 machines gives parse error if bigger than this
261+
if [ "$(uname -m)" = "armv7l" ]; then
262+
SPACE_TO_KEEP=2100000000
263+
else
264+
SPACE_TO_KEEP=10000000000
265+
fi
266+
docker builder prune -f --keep-storage ${SPACE_TO_KEEP}
267+
}
268+
256269
# Check if a given docker image exists on the server.
257270
# This script errors out if the image does not exist.
258271
function check_image() {

0 commit comments

Comments
 (0)