diff --git a/alpine-make-vm-image b/alpine-make-vm-image index 6596883..d47c197 100755 --- a/alpine-make-vm-image +++ b/alpine-make-vm-image @@ -447,6 +447,11 @@ else dump_alpine_keys etc/apk/keys/ fi +# Use APK cache if available. +if [ -L /etc/apk/cache ]; then + ln -s "$(realpath /etc/apk/cache)" etc/apk/cache +fi + _apk add --root . --update-cache --initdb alpine-base prepare_chroot . @@ -493,6 +498,11 @@ if [ "$PACKAGES" ]; then _apk add --root . $PACKAGES fi +#----------------------------------------------------------------------- +if [ -L /etc/apk/cache ]; then + rm etc/apk/cache >/dev/null 2>&1 +fi + #----------------------------------------------------------------------- if [ "$SCRIPT" ]; then script_name="${SCRIPT##*/}"