Spaces:
Sleeping
Sleeping
| # Script to clean up LegisQA Docker containers and images | |
| IMAGE_NAME="legisqa-local" | |
| CONTAINER_NAME="legisqa-container" | |
| echo "🧹 Cleaning up LegisQA Docker resources..." | |
| echo "" | |
| # Stop and remove the running container if it exists | |
| echo "Stopping container: $CONTAINER_NAME" | |
| if docker stop $CONTAINER_NAME 2>/dev/null; then | |
| echo "✅ Container $CONTAINER_NAME stopped" | |
| else | |
| echo "ℹ️ Container $CONTAINER_NAME not running" | |
| fi | |
| echo "" | |
| # Remove the container if it exists (in case it's stopped but not removed) | |
| echo "Removing container: $CONTAINER_NAME" | |
| if docker rm $CONTAINER_NAME 2>/dev/null; then | |
| echo "✅ Container $CONTAINER_NAME removed" | |
| else | |
| echo "ℹ️ Container $CONTAINER_NAME not found" | |
| fi | |
| echo "" | |
| # Remove the image if it exists | |
| echo "Removing image: $IMAGE_NAME" | |
| if docker rmi $IMAGE_NAME 2>/dev/null; then | |
| echo "✅ Image $IMAGE_NAME removed" | |
| else | |
| echo "ℹ️ Image $IMAGE_NAME not found" | |
| fi | |
| echo "" | |
| # Optional: Clean up dangling images and build cache | |
| read -p "🗑️ Clean up dangling images and build cache? (y/N): " -n 1 -r | |
| echo "" | |
| if [[ $REPLY =~ ^[Yy]$ ]]; then | |
| echo "Cleaning up dangling images..." | |
| docker image prune -f | |
| echo "Cleaning up build cache..." | |
| docker builder prune -f | |
| echo "✅ Cleanup complete!" | |
| else | |
| echo "ℹ️ Skipped cleanup of dangling images and build cache" | |
| fi | |
| echo "" | |
| echo "🎉 LegisQA Docker cleanup finished!" | |
| echo "" | |
| echo "To rebuild and run:" | |
| echo " ./build-docker.sh" | |
| echo " ./run-docker.sh" | |