-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-docker-build.sh
More file actions
77 lines (61 loc) · 1.76 KB
/
Copy pathtest-docker-build.sh
File metadata and controls
77 lines (61 loc) · 1.76 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
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
echo "🐳 Testing Docker Build for AI Chatbot"
echo "======================================"
# Check if .env file exists
if [ ! -f ".env" ]; then
echo "⚠️ .env file not found. Creating from example..."
cp env.example .env
echo "📝 Please edit .env and add your GROQ_API_KEY"
fi
echo "🔍 Checking Docker and Docker Compose..."
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed or not in PATH"
exit 1
fi
if ! command -v docker-compose &> /dev/null; then
echo "❌ Docker Compose is not installed or not in PATH"
exit 1
fi
echo "✅ Docker and Docker Compose are available"
echo "🧹 Cleaning up previous builds..."
docker-compose down --remove-orphans
docker system prune -f
echo "🔨 Building backend..."
docker-compose build backend
if [ $? -eq 0 ]; then
echo "✅ Backend build successful"
else
echo "❌ Backend build failed"
exit 1
fi
echo "🔨 Building frontend..."
docker-compose build frontend
if [ $? -eq 0 ]; then
echo "✅ Frontend build successful"
else
echo "❌ Frontend build failed"
exit 1
fi
echo "🚀 Starting services..."
docker-compose up -d
echo "⏳ Waiting for services to be ready..."
sleep 10
echo "🔍 Testing backend health..."
curl -f http://localhost:8004/ > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "✅ Backend is healthy"
else
echo "❌ Backend health check failed"
fi
echo "🔍 Testing frontend..."
curl -f http://localhost/ > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "✅ Frontend is accessible"
else
echo "❌ Frontend is not accessible"
fi
echo "📊 Service status:"
docker-compose ps
echo "🎉 Docker build test completed!"
echo "🌐 Access your app at: http://localhost"
echo "🔧 Backend API at: http://localhost:8004"