#!/bin/bash # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' # No Color echo -e "${BLUE}๐Ÿ›‘ Stopping Automated Development Pipeline${NC}" echo "========================================" # Check if we're in the right directory if [ ! -f "docker-compose.yml" ]; then echo -e "${RED}โŒ Error: docker-compose.yml not found. Please run from project root directory.${NC}" exit 1 fi # Detect Docker Compose command if command -v "docker" &> /dev/null && docker compose version &> /dev/null; then DOCKER_COMPOSE="docker compose" elif command -v docker-compose &> /dev/null; then DOCKER_COMPOSE="docker-compose" else echo -e "${RED}โŒ Docker Compose is not available.${NC}" exit 1 fi # Show current running services echo -e "${BLUE}๐Ÿ“Š Current running services:${NC}" $DOCKER_COMPOSE ps echo "" echo -e "${BLUE}โน๏ธ Stopping all services gracefully...${NC}" # Stop services $DOCKER_COMPOSE stop echo -e "${BLUE}๐Ÿ—‘๏ธ Removing containers...${NC}" $DOCKER_COMPOSE down # Optional: Remove volumes read -p "Do you want to remove all data volumes? This will delete all databases and reset the system. (y/N): " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then echo -e "${YELLOW}๐Ÿ—‘๏ธ Removing volumes and data...${NC}" $DOCKER_COMPOSE down -v echo -e "${YELLOW}โš ๏ธ All data has been removed!${NC}" fi # Clean up echo -e "${BLUE}๏ฟฝ๏ฟฝ Cleaning up orphaned containers and networks...${NC}" $DOCKER_COMPOSE down --remove-orphans echo "" echo -e "${GREEN}โœ… All services stopped successfully!${NC}" echo "" echo -e "${BLUE}๐Ÿ“ Available commands:${NC}" echo " ๐Ÿš€ Start again: ./scripts/setup/start.sh" echo " ๐Ÿ“Š Check status: ./scripts/setup/status.sh" echo " ๐Ÿงน Full cleanup: docker system prune -a"