diff --git a/.install/bin/pdm-build b/.install/bin/pdm-build index a812e78..1612690 100755 --- a/.install/bin/pdm-build +++ b/.install/bin/pdm-build @@ -39,7 +39,6 @@ as the image name. Options: -d Debug mode: don't delete the temporary container created by the script - when encountering an error -r Redo build from scratch instead of using cached layers -s Squash all layers in the image into a single layer -t tag Tag the image with the given string. Can be used multiple times to assign @@ -127,6 +126,10 @@ if [[ -f Initfile ]]; then podman exec tmp-$epoch bash -c "chmod +x /root/Initfile && /root/Initfile" echo "Committing container tmp-$epoch to image $name:$today ..." podman commit tmp-$epoch "$name:$today" + if [[ $opt_debug -eq 0 ]]; then + echo "Removing temporary container tmp-$epoch ..." + podman rm -i -f tmp-$epoch + fi else echo "Initfile not found, skipping temporary container step ..." # tag image we already built with appropriate tag, and untag with tmp @@ -134,8 +137,10 @@ else podman tag tmp-$epoch "$name:$today" fi -echo "Removing temporary image tmp-$epoch ..." -podman rmi tmp-$epoch +if ! podman container exists tmp-$epoch ; then + echo "Removing temporary image tmp-$epoch ..." + podman rmi tmp-$epoch +fi # tag image as latest echo "Adding latest tag to image $name:$today ..."