#!/bin/bash
# Clean Docker builder images and cache
# Forces a fresh image build on next run

set -e

BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
source "$BUILD_ROOT/helpers/message-helpers.sh"

print_header "Cleaning Docker Builder Images"

# Remove all omarchy-pkg-builder images
print_info "Removing omarchy-pkg-builder images..."
docker images omarchy-pkg-builder -q | xargs -r docker rmi -f 2>/dev/null || true

# Clear buildx cache for these builds
print_info "Clearing buildx cache..."
docker buildx prune -a -f

print_success "Docker builder cache cleared"
print_info "Next build will create fresh images"
