Skip to content

Commit 9a61b45

Browse files
Copilotntindle
andcommitted
feat: Complete container publishing implementation with deployment tools and templates
Co-authored-by: ntindle <8845353+ntindle@users.noreply.github.com>
1 parent 1d207a9 commit 9a61b45

File tree

4 files changed

+492
-3
lines changed

4 files changed

+492
-3
lines changed

autogpt_platform/README.md

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,38 @@
22

33
Welcome to the AutoGPT Platform - a powerful system for creating and running AI agents to solve business problems. This platform enables you to harness the power of artificial intelligence to automate tasks, analyze data, and generate insights for your organization.
44

5-
## Getting Started
5+
## Deployment Options
6+
7+
### Quick Deploy with Published Containers (Recommended)
8+
9+
The fastest way to get started is using our pre-built containers:
10+
11+
```bash
12+
# Download and run with published images
13+
curl -fsSL https://raw.githubusercontent.com/Significant-Gravitas/AutoGPT/master/autogpt_platform/deploy.sh -o deploy.sh
14+
chmod +x deploy.sh
15+
./deploy.sh deploy
16+
```
17+
18+
Access the platform at http://localhost:3000 after deployment completes.
19+
20+
### Platform-Specific Deployments
21+
22+
- **Unraid**: [Deployment Guide](../docs/content/platform/deployment/unraid.md)
23+
- **Home Assistant**: [Add-on Guide](../docs/content/platform/deployment/home-assistant.md)
24+
- **Kubernetes**: [K8s Deployment](../docs/content/platform/deployment/kubernetes.md)
25+
- **General Containers**: [Container Guide](../docs/content/platform/container-deployment.md)
26+
27+
## Development Setup
628

729
### Prerequisites
830

931
- Docker
1032
- Docker Compose V2 (comes with Docker Desktop, or can be installed separately)
1133

12-
### Running the System
34+
### Running from Source
1335

14-
To run the AutoGPT Platform, follow these steps:
36+
To run the AutoGPT Platform from source for development:
1537

1638
1. Clone this repository to your local machine and navigate to the `autogpt_platform` directory within the repository:
1739

@@ -157,3 +179,28 @@ If you need to update the API client after making changes to the backend API:
157179
```
158180

159181
This will fetch the latest OpenAPI specification and regenerate the TypeScript client code.
182+
183+
## Container Deployment
184+
185+
For production deployments and specific platforms, see our container deployment guides:
186+
187+
- **[Container Deployment Overview](CONTAINERS.md)** - Complete guide to using published containers
188+
- **[Deployment Script](deploy.sh)** - Automated deployment and management tool
189+
- **[Published Images](docker-compose.published.yml)** - Docker Compose for published containers
190+
191+
### Published Container Images
192+
193+
- **Backend**: `ghcr.io/significant-gravitas/autogpt-platform-backend:latest`
194+
- **Frontend**: `ghcr.io/significant-gravitas/autogpt-platform-frontend:latest`
195+
196+
### Quick Production Deployment
197+
198+
```bash
199+
# Deploy with published containers
200+
./deploy.sh deploy
201+
202+
# Or use the published compose file directly
203+
docker compose -f docker-compose.published.yml up -d
204+
```
205+
206+
For detailed deployment instructions, troubleshooting, and platform-specific guides, see the [Container Documentation](CONTAINERS.md).

autogpt_platform/build-test.sh

Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
#!/bin/bash
2+
3+
# AutoGPT Platform Container Build Test Script
4+
# This script tests container builds locally before CI/CD
5+
6+
set -euo pipefail
7+
8+
# Colors for output
9+
RED='\033[0;31m'
10+
GREEN='\033[0;32m'
11+
YELLOW='\033[1;33m'
12+
BLUE='\033[0;34m'
13+
NC='\033[0m' # No Color
14+
15+
# Configuration
16+
REGISTRY="ghcr.io"
17+
IMAGE_PREFIX="significant-gravitas/autogpt-platform"
18+
VERSION="test"
19+
BUILD_ARGS=""
20+
21+
# Functions
22+
info() {
23+
echo -e "${BLUE}[INFO]${NC} $1"
24+
}
25+
26+
success() {
27+
echo -e "${GREEN}[SUCCESS]${NC} $1"
28+
}
29+
30+
warning() {
31+
echo -e "${YELLOW}[WARNING]${NC} $1"
32+
}
33+
34+
error() {
35+
echo -e "${RED}[ERROR]${NC} $1"
36+
}
37+
38+
usage() {
39+
cat << EOF
40+
AutoGPT Platform Container Build Test Script
41+
42+
Usage: $0 [OPTIONS] [COMPONENT]
43+
44+
COMPONENTS:
45+
backend Build backend container only
46+
frontend Build frontend container only
47+
all Build both containers (default)
48+
49+
OPTIONS:
50+
-r, --registry REGISTRY Container registry (default: ghcr.io)
51+
-t, --tag TAG Image tag (default: test)
52+
--no-cache Build without cache
53+
--push Push images after build
54+
-h, --help Show this help message
55+
56+
EXAMPLES:
57+
$0 # Build both containers
58+
$0 backend # Build backend only
59+
$0 --no-cache all # Build without cache
60+
$0 --push frontend # Build and push frontend
61+
62+
EOF
63+
}
64+
65+
check_docker() {
66+
if ! command -v docker &> /dev/null; then
67+
error "Docker is not installed"
68+
exit 1
69+
fi
70+
71+
if ! docker info &> /dev/null; then
72+
error "Docker daemon is not running"
73+
exit 1
74+
fi
75+
76+
success "Docker is available"
77+
}
78+
79+
build_backend() {
80+
info "Building backend container..."
81+
82+
local image_name="$REGISTRY/$IMAGE_PREFIX-backend:$VERSION"
83+
local dockerfile="autogpt_platform/backend/Dockerfile"
84+
85+
info "Building: $image_name"
86+
info "Dockerfile: $dockerfile"
87+
info "Context: ."
88+
info "Target: server"
89+
90+
if docker build \
91+
-t "$image_name" \
92+
-f "$dockerfile" \
93+
--target server \
94+
$BUILD_ARGS \
95+
.; then
96+
success "Backend container built successfully: $image_name"
97+
98+
# Test the container
99+
info "Testing backend container..."
100+
if docker run --rm -d --name autogpt-backend-test "$image_name" > /dev/null; then
101+
sleep 5
102+
if docker ps | grep -q autogpt-backend-test; then
103+
success "Backend container is running"
104+
docker stop autogpt-backend-test > /dev/null
105+
else
106+
warning "Backend container started but may have issues"
107+
fi
108+
else
109+
warning "Failed to start backend container for testing"
110+
fi
111+
112+
return 0
113+
else
114+
error "Backend container build failed"
115+
return 1
116+
fi
117+
}
118+
119+
build_frontend() {
120+
info "Building frontend container..."
121+
122+
local image_name="$REGISTRY/$IMAGE_PREFIX-frontend:$VERSION"
123+
local dockerfile="autogpt_platform/frontend/Dockerfile"
124+
125+
info "Building: $image_name"
126+
info "Dockerfile: $dockerfile"
127+
info "Context: ."
128+
info "Target: prod"
129+
130+
if docker build \
131+
-t "$image_name" \
132+
-f "$dockerfile" \
133+
--target prod \
134+
$BUILD_ARGS \
135+
.; then
136+
success "Frontend container built successfully: $image_name"
137+
138+
# Test the container
139+
info "Testing frontend container..."
140+
if docker run --rm -d --name autogpt-frontend-test -p 3001:3000 "$image_name" > /dev/null; then
141+
sleep 10
142+
if docker ps | grep -q autogpt-frontend-test; then
143+
if curl -s -o /dev/null -w "%{http_code}" http://localhost:3001 | grep -q "200\|302\|404"; then
144+
success "Frontend container is responding"
145+
else
146+
warning "Frontend container started but not responding to HTTP requests"
147+
fi
148+
docker stop autogpt-frontend-test > /dev/null
149+
else
150+
warning "Frontend container started but may have issues"
151+
fi
152+
else
153+
warning "Failed to start frontend container for testing"
154+
fi
155+
156+
return 0
157+
else
158+
error "Frontend container build failed"
159+
return 1
160+
fi
161+
}
162+
163+
push_images() {
164+
if [[ "$PUSH_IMAGES" == "true" ]]; then
165+
info "Pushing images to registry..."
166+
167+
local backend_image="$REGISTRY/$IMAGE_PREFIX-backend:$VERSION"
168+
local frontend_image="$REGISTRY/$IMAGE_PREFIX-frontend:$VERSION"
169+
170+
for image in "$backend_image" "$frontend_image"; do
171+
if docker images | grep -q "$image"; then
172+
info "Pushing $image..."
173+
if docker push "$image"; then
174+
success "Pushed $image"
175+
else
176+
error "Failed to push $image"
177+
fi
178+
fi
179+
done
180+
fi
181+
}
182+
183+
show_images() {
184+
info "Built images:"
185+
docker images | grep "$IMAGE_PREFIX" | grep "$VERSION"
186+
}
187+
188+
cleanup_test_containers() {
189+
# Clean up any test containers that might be left running
190+
docker ps -a | grep "autogpt-.*-test" | awk '{print $1}' | xargs -r docker rm -f > /dev/null 2>&1 || true
191+
}
192+
193+
# Parse command line arguments
194+
COMPONENT="all"
195+
PUSH_IMAGES="false"
196+
197+
while [[ $# -gt 0 ]]; do
198+
case $1 in
199+
-r|--registry)
200+
REGISTRY="$2"
201+
shift 2
202+
;;
203+
-t|--tag)
204+
VERSION="$2"
205+
shift 2
206+
;;
207+
--no-cache)
208+
BUILD_ARGS="$BUILD_ARGS --no-cache"
209+
shift
210+
;;
211+
--push)
212+
PUSH_IMAGES="true"
213+
shift
214+
;;
215+
-h|--help)
216+
usage
217+
exit 0
218+
;;
219+
backend|frontend|all)
220+
COMPONENT="$1"
221+
shift
222+
;;
223+
*)
224+
error "Unknown option: $1"
225+
usage
226+
exit 1
227+
;;
228+
esac
229+
done
230+
231+
# Main execution
232+
info "AutoGPT Platform Container Build Test"
233+
info "Component: $COMPONENT"
234+
info "Registry: $REGISTRY"
235+
info "Tag: $VERSION"
236+
237+
check_docker
238+
cleanup_test_containers
239+
240+
# Build containers based on component selection
241+
case "$COMPONENT" in
242+
backend)
243+
build_backend
244+
;;
245+
frontend)
246+
build_frontend
247+
;;
248+
all)
249+
if build_backend && build_frontend; then
250+
success "All containers built successfully"
251+
else
252+
error "Some container builds failed"
253+
exit 1
254+
fi
255+
;;
256+
esac
257+
258+
push_images
259+
show_images
260+
cleanup_test_containers
261+
262+
success "Build test completed successfully"

0 commit comments

Comments
 (0)