zkt26/z1/remove-app.sh
2026-04-01 10:00:23 +02:00

40 lines
1.7 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# ============================================================
# remove-app.sh Remove ALL NitheeshWork containers, images,
# volumes, and network (full cleanup)
# ============================================================
set -euo pipefail
echo "╔══════════════════════════════════════════════╗"
echo "║ NitheeshWork Remove Application ║"
echo "╚══════════════════════════════════════════════╝"
echo ""
echo "⚠ WARNING: This will delete all data, including"
echo " the PostgreSQL database and Redis cache."
echo ""
read -rp " Are you sure? Type 'yes' to confirm: " confirm
[[ "$confirm" == "yes" ]] || { echo "Aborted."; exit 0; }
cd "$(dirname "$0")"
echo ""
echo "▸ Stopping and removing containers…"
docker compose down --remove-orphans 2>/dev/null || true
echo ""
echo "▸ Removing named volumes…"
for vol in nitheeshwork-postgres-data nitheeshwork-redis-data nitheeshwork-pgadmin-data; do
docker volume rm "$vol" 2>/dev/null && echo " Removed: $vol" || echo " Volume $vol not found, skipping."
done
echo ""
echo "▸ Removing Docker network…"
docker network rm nitheeshwork-net 2>/dev/null && echo " Removed: nitheeshwork-net" || echo " Network not found, skipping."
echo ""
echo "▸ Removing built images…"
docker rmi nitheeshwork-backend:latest 2>/dev/null && echo " Removed: nitheeshwork-backend:latest" || echo " Image not found, skipping."
echo ""
echo "✔ All NitheeshWork resources have been removed."