Files
discord-rpg-concept/shared/scripts/docker-cleanup.sh

42 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Cleanup script for Docker resources
# Use: ./shared/scripts/docker-cleanup.sh
set -e
echo "🧹 Aurora Docker Cleanup"
echo "========================"
# Stop running containers for this project
echo ""
echo "📦 Stopping Aurora containers..."
docker compose down 2>/dev/null || true
# Remove dangling images (untagged images from failed builds)
echo ""
echo "🗑️ Removing dangling images..."
docker image prune -f
# Optional: Remove unused build cache
echo ""
read -p "🔧 Remove Docker build cache? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
docker builder prune -f
echo "✓ Build cache cleared"
fi
# Optional: Remove node_modules volumes (forces fresh install)
echo ""
read -p "📁 Remove node_modules volumes? (forces fresh install) (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
docker volume rm aurora_app_node_modules aurora_web_node_modules 2>/dev/null || true
echo "✓ Node modules volumes removed"
fi
echo ""
echo "✅ Cleanup complete!"
echo ""
echo "Run 'docker compose up --build' to rebuild"