-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-rebuild.sh
More file actions
executable file
·67 lines (57 loc) · 2.04 KB
/
docker-rebuild.sh
File metadata and controls
executable file
·67 lines (57 loc) · 2.04 KB
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
65
66
67
#!/bin/bash
# Docker Cleanup and Rebuild Script for Terminal Chat Program
# Use this if you encounter "ContainerConfig" errors or restart issues
echo "=== Terminal Chat Program - Docker Rebuild Script ==="
echo ""
echo "This script will:"
echo "1. Stop and remove existing containers"
echo "2. Remove old images"
echo "3. Clean up volumes (optional)"
echo "4. Rebuild from scratch"
echo ""
# Stop and remove containers
echo "Step 1: Stopping containers..."
docker-compose down 2>/dev/null || docker compose down 2>/dev/null || true
# Remove specific container if it exists
echo "Step 2: Removing old container..."
docker rm -f terminal-chat-server 2>/dev/null || docker rm -f vibe-chat-server 2>/dev/null || true
# Remove old image
echo "Step 3: Removing old image..."
docker rmi terminal-chat:latest 2>/dev/null || docker rmi vibe-chat:latest 2>/dev/null || true
# Ask about volumes
read -p "Do you want to clean volumes (will delete chat history)? (y/N): " clean_volumes
if [[ $clean_volumes == "y" || $clean_volumes == "Y" ]]; then
echo "Step 4: Removing volumes..."
docker volume rm terminal-chat-shared terminal-chat-logs 2>/dev/null || \
docker volume rm vibe-chat-shared vibe-chat-logs 2>/dev/null || true
else
echo "Step 4: Keeping volumes (chat history preserved)"
fi
# Check for .env file
if [ ! -f .env ]; then
echo ""
echo "WARNING: .env file not found!"
echo "Creating .env from .env.example..."
cp .env.example .env
echo "Please edit .env and set a strong CHAT_PASSWORD before continuing!"
read -p "Press Enter after editing .env..."
fi
# Rebuild and start
echo ""
echo "Step 5: Building fresh image..."
docker-compose build --no-cache || docker compose build --no-cache
echo ""
echo "Step 6: Starting services..."
docker-compose up -d || docker compose up -d
echo ""
echo "=== Checking status ===="
sleep 3
docker-compose ps || docker compose ps
echo ""
echo "=== View logs with: ==="
echo "docker-compose logs -f chat-server"
echo ""
echo "=== Connect clients with: ==="
echo "python3 bin/vibe-chat.py"
echo ""
echo "Done!"