zkt26/z1/remove-app.sh

46 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# =============================================
# remove-app.sh
# Removes ALL traces of the Task Manager app:
# - Stops and removes containers
# - Removes networks
# - Removes persistent volumes
# - Removes locally built images
# =============================================
set -e
echo "============================================="
echo " Removing Task Manager Application..."
echo "============================================="
echo ""
# Navigate to the script's directory
cd "$(dirname "$0")"
# Stop and remove containers, networks, volumes, and local images
echo "[1/3] Stopping and removing containers, networks, and volumes..."
docker compose down -v --remove-orphans 2>/dev/null || true
echo " ✓ Containers, networks, and volumes removed"
echo ""
# Remove locally built images
echo "[2/3] Removing locally built images..."
docker rmi z1-frontend z1-api 2>/dev/null || true
docker rmi taskapp-frontend taskapp-api 2>/dev/null || true
echo " ✓ Local images removed"
echo ""
# Clean up any remaining named resources
echo "[3/3] Cleaning up remaining resources..."
docker volume rm taskapp-pgdata 2>/dev/null || true
docker volume rm taskapp-redisdata 2>/dev/null || true
docker network rm taskapp-frontend-net 2>/dev/null || true
docker network rm taskapp-backend-net 2>/dev/null || true
echo " ✓ Cleanup complete"
echo ""
echo "============================================="
echo " ✓ Application completely removed."
echo "============================================="