40 lines
1.7 KiB
Bash
40 lines
1.7 KiB
Bash
#!/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."
|