Skip to content

Commit bb5155b

Browse files
committed
feat: add option to removed loaded images
1 parent bfbe28e commit bb5155b

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

run_demo.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ while [ -n "${1:-}" ]; do case $1 in
216216
shift
217217
continue ;;
218218

219+
--prune-loaded-images)
220+
prune_loaded_images=1
221+
shift
222+
continue ;;
223+
219224
--ci-values)
220225
shift
221226
if [[ -z "${1:-}" ]]; then
@@ -567,12 +572,16 @@ fi
567572

568573

569574
# Load images into kind
570-
571575
if [ ${#docker_images_to_load[@]} -ne 0 ]; then
572-
printf "%b Loading docker images...\n" ${UNICORN_EMOJI}
573-
for img_name in "${docker_images_to_load[@]}"
574-
do
575-
"${demo_dir}/kind" --name diracx-demo load docker-image "${img_name}"
576+
printf "%b Loading docker images...\n" ${UNICORN_EMOJI}
577+
for img_name in "${docker_images_to_load[@]}"; do
578+
"${demo_dir}/kind" --name diracx-demo load docker-image "${img_name}"
579+
580+
if [[ ${prune_loaded_images:-0} -eq 1 ]]; then
581+
printf "%b Pruning ${img_name} locally\n" ${UNICORN_EMOJI}
582+
# Delete the tag (will delete the layers if no other tag is using them)
583+
docker image rm -f "${img_name}"
584+
fi
576585
done
577586

578587

0 commit comments

Comments
 (0)