File size: 1,952 Bytes
55896b1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #!/bin/bash
# ============================================
# Premium Valentine Website - Docker Stop Script
# Gracefully stop and clean up containers
# ============================================
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
CONTAINER_NAME="valentine-experience"
echo -e "${BLUE}ββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo -e "${BLUE}β Valentine Experience - Docker Stop β${NC}"
echo -e "${BLUE}ββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo ""
# Check if Docker Compose is being used
if [ -f "docker-compose.yml" ] && command -v docker-compose &> /dev/null; then
echo -e "${BLUE}Stopping Docker Compose services...${NC}"
docker-compose down
if [ $? -eq 0 ]; then
echo -e "${GREEN}β
Services stopped successfully${NC}"
else
echo -e "${RED}β Failed to stop services${NC}"
exit 1
fi
else
# Stop using Docker CLI
if [ "$(docker ps -q -f name=${CONTAINER_NAME})" ]; then
echo -e "${BLUE}Stopping container...${NC}"
docker stop ${CONTAINER_NAME}
if [ $? -eq 0 ]; then
echo -e "${GREEN}β
Container stopped${NC}"
else
echo -e "${RED}β Failed to stop container${NC}"
exit 1
fi
echo -e "${BLUE}Removing container...${NC}"
docker rm ${CONTAINER_NAME}
if [ $? -eq 0 ]; then
echo -e "${GREEN}β
Container removed${NC}"
else
echo -e "${RED}β Failed to remove container${NC}"
exit 1
fi
else
echo -e "${YELLOW}β οΈ Container is not running${NC}"
fi
fi
echo ""
echo -e "${GREEN}β
Cleanup complete!${NC}"
|