-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdocker-test.sh
More file actions
executable file
·57 lines (44 loc) · 1.33 KB
/
Copy pathdocker-test.sh
File metadata and controls
executable file
·57 lines (44 loc) · 1.33 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
#!/bin/bash
# Docker Test Script for Codex2API
set -e
echo "🐳 Codex2API Docker Test"
echo "========================"
# Check if Docker is running
if ! docker info > /dev/null 2>&1; then
echo "❌ Docker is not running. Please start Docker and try again."
exit 1
fi
# Check if auth.json exists
if [ ! -f "auth.json" ]; then
echo "❌ auth.json not found. Please run 'uv run get_token.py' first."
exit 1
fi
echo "🔨 Building Docker image..."
docker build -t codex2api-test .
echo "✅ Docker image built successfully"
echo "🚀 Testing Docker container..."
# Run container in detached mode
CONTAINER_ID=$(docker run -d \
--name codex2api-test \
-p 8001:8000 \
-v $(pwd)/auth.json:/app/auth.json:ro \
-v $(pwd)/models.json:/app/models.json:ro \
codex2api-test)
echo "📋 Container ID: $CONTAINER_ID"
# Wait for container to start
echo "⏳ Waiting for container to start..."
sleep 10
# Test health endpoint
echo "🔍 Testing health endpoint..."
if curl -f http://localhost:8001/health > /dev/null 2>&1; then
echo "✅ Health check passed"
else
echo "❌ Health check failed"
echo "📋 Container logs:"
docker logs codex2api-test
fi
# Cleanup
echo "🧹 Cleaning up..."
docker stop codex2api-test > /dev/null 2>&1 || true
docker rm codex2api-test > /dev/null 2>&1 || true
echo "✅ Docker test completed"