-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_and_deploy.sh
More file actions
executable file
·62 lines (52 loc) · 1.57 KB
/
build_and_deploy.sh
File metadata and controls
executable file
·62 lines (52 loc) · 1.57 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
#!/bin/bash
#
# Build and Deploy Script for PRISM API
# Builds Docker image for x86_64 and pushes to ECR
#
set -e # Exit on any error
echo "🚀 Starting PRISM API Build and Deploy..."
echo "================================================"
# Navigate to project root (where Dockerfile is located)
cd "$(dirname "$0")"
PROJECT_ROOT=$(pwd)
echo "📁 Project root: $PROJECT_ROOT"
# Check if Dockerfile exists
if [ ! -f "Dockerfile" ]; then
echo "❌ Dockerfile not found in $PROJECT_ROOT"
echo "Make sure you're running this script from the tumorguard directory"
exit 1
fi
# Build Docker image
echo ""
echo "🔨 Building Docker image for x86_64..."
docker buildx build --platform linux/amd64 -t prism-api:latest --load .
if [ $? -eq 0 ]; then
echo "✅ Docker image built successfully!"
else
echo "❌ Docker build failed!"
exit 1
fi
# Push to ECR
echo ""
echo "📤 Pushing to ECR..."
cd interface/backend
# Check if ECR push script exists
if [ ! -f "push_to_ecr.py" ]; then
echo "❌ push_to_ecr.py not found in interface/backend"
exit 1
fi
python3 push_to_ecr.py
if [ $? -eq 0 ]; then
echo ""
echo "🎉 SUCCESS! Image deployed to ECR"
echo "================================================"
echo "Next steps:"
echo "1. Go to AWS Console → ECS → Your Service"
echo "2. Click 'Update Service' → 'Force new deployment'"
echo "3. Wait 2-3 minutes for deployment"
echo "4. Test at: http://your-alb-url/health"
echo "5. Try mock endpoint: http://your-alb-url/predict/mock/test"
else
echo "❌ ECR push failed!"
exit 1
fi