Skip to content

Commit

Permalink
Prevent base images from accidental prune
Browse files Browse the repository at this point in the history
Base images sometimes used to be pruned as part of a rebuild when they
became dangling.  That could happen when the "rpm" image was based on a
different version of the base image.

This was super annoying since you had to wait for the whole package set
to be downloaded and installed again.

Luckily, base images don't change as often so we can perhaps afford to
keep each version around.  Do that by simply adding the Dockerfile hash
to the tag name.

(cherry picked from commit 766192a)
  • Loading branch information
dmnks committed Feb 7, 2025
1 parent ca65c35 commit 1b0fd42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/mktree.oci
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fi
CACHE_DIR="mktree.cache"
IID_FILE="$CACHE_DIR/image-id"
IMAGE_ID=$(cat $IID_FILE 2>/dev/null || echo "")
BASE_TAG="rpm/base"
BASE_TAG="rpm/base:$(sha256sum Dockerfile | head -c8)"
ARGS="-f Dockerfile $FROM $CONTEXT"
ROOTLESS=$([ $(id -u) == 0 ] && echo 0 || echo 1)
CMD=$1; shift
Expand Down

0 comments on commit 1b0fd42

Please sign in to comment.