feat: container management tools in tools/
Shell scripts for build, start, stop, restart, nuke, logs, status. Shared helpers in _common.sh (colours, compose detection, project root). Updated CHEATSHEET.md with new tool references. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
26
tools/nuke
Executable file
26
tools/nuke
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# Full teardown: stop container and remove image.
|
||||
# Usage: tools/nuke
|
||||
|
||||
# shellcheck source=tools/_common.sh
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/_common.sh"
|
||||
cd "$PROJECT_DIR" || exit 1
|
||||
|
||||
dim "Stopping container..."
|
||||
$COMPOSE down 2>/dev/null || true
|
||||
|
||||
before=$(podman system df --format '{{.Size}}' 2>/dev/null | head -1 || true)
|
||||
|
||||
dim "Removing image..."
|
||||
podman rmi "$IMAGE_NAME" 2>/dev/null || true
|
||||
# Also remove any dangling derp images
|
||||
podman images --filter "reference=*derp*" --format '{{.ID}}' 2>/dev/null | \
|
||||
xargs -r podman rmi 2>/dev/null || true
|
||||
|
||||
after=$(podman system df --format '{{.Size}}' 2>/dev/null | head -1 || true)
|
||||
|
||||
if [[ -n "$before" && -n "$after" ]]; then
|
||||
info "Teardown complete (images: $before -> $after)"
|
||||
else
|
||||
info "Teardown complete"
|
||||
fi
|
||||
Reference in New Issue
Block a user