-
-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathtest-build.sh
More file actions
executable file
Β·135 lines (110 loc) Β· 3.68 KB
/
test-build.sh
File metadata and controls
executable file
Β·135 lines (110 loc) Β· 3.68 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
# Test script for multi-platform container builds
# Tests both Docker and Apple container builds locally
set -e
echo "π CodeRunner Multi-Platform Build Test"
echo "========================================"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
echo -e "${GREEN}β
$1${NC}"
}
print_warning() {
echo -e "${YELLOW}β οΈ $1${NC}"
}
print_error() {
echo -e "${RED}β $1${NC}"
}
# Check if we're on macOS
if [[ "$OSTYPE" == "darwin"* ]]; then
MACOS=true
echo "π macOS detected"
else
MACOS=false
echo "π§ Non-macOS system detected"
fi
echo ""
echo "1. Testing Docker Build"
echo "----------------------"
# Check if Docker is available
if ! command -v docker &> /dev/null; then
print_error "Docker not found. Please install Docker."
exit 1
fi
print_status "Docker found: $(docker --version)"
# Test basic Docker build
echo "Building with Docker..."
if docker build -t coderunner-docker-test .; then
print_status "Docker build successful"
else
print_error "Docker build failed"
exit 1
fi
# Test if the Docker image runs
echo "Testing Docker container startup..."
DOCKER_CONTAINER_ID=$(docker run -d -p 8223:8222 coderunner-docker-test)
sleep 5
# Check if container is running
if docker ps | grep -q "$DOCKER_CONTAINER_ID"; then
print_status "Docker container started successfully"
# Test MCP endpoint (basic connectivity test)
if curl -s --fail --connect-timeout 5 http://localhost:8223/mcp > /dev/null; then
print_status "MCP endpoint responding on Docker container"
else
print_warning "MCP endpoint not responding (may need more startup time)"
fi
# Cleanup
docker stop "$DOCKER_CONTAINER_ID" > /dev/null
print_status "Docker container stopped and cleaned up"
else
print_error "Docker container failed to start"
fi
echo ""
echo "2. Testing Docker Multi-Architecture Build"
echo "-----------------------------------------"
# Check if buildx is available
if docker buildx version &> /dev/null; then
print_status "Docker buildx found"
# Create builder if it doesn't exist
if ! docker buildx inspect multiarch-builder &> /dev/null; then
echo "Creating multi-arch builder..."
docker buildx create --name multiarch-builder --use
else
docker buildx use multiarch-builder
fi
# Test multi-arch build (without pushing)
echo "Testing multi-architecture build..."
if docker buildx build --platform linux/amd64,linux/arm64 -t coderunner-multiarch .; then
print_status "Multi-architecture build successful"
else
print_error "Multi-architecture build failed"
fi
else
print_warning "Docker buildx not available - skipping multi-arch test"
fi
# Skip Apple container test for now
if $MACOS; then
echo ""
echo "3. Apple Container Build (SKIPPED)"
echo "---------------------------------"
print_warning "Apple container test skipped - focusing on Docker builds"
fi
echo ""
echo "4. Build Comparison Summary"
echo "=========================="
echo "Docker image size:"
docker images coderunner-docker-test --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"
# Apple container comparison skipped
echo ""
echo "π Build test completed!"
echo ""
echo "Next steps:"
echo "- If builds are successful, you can push to registries:"
echo " Docker: docker tag coderunner-docker-test instavm/coderunner:docker-latest"
echo " Apple: container images tag coderunner-apple-test instavm/coderunner:apple-latest"
echo "- Set up automated builds with GitHub Actions"
echo "- Update documentation with multi-platform instructions"