-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload.sh
More file actions
executable file
·63 lines (52 loc) · 1.6 KB
/
upload.sh
File metadata and controls
executable file
·63 lines (52 loc) · 1.6 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
#!/bin/bash
# Pluto App Upload Script - Shell version
# This builds and pushes the Docker image to ECR
set -e
AWS_ACCOUNT_ID="300264401084"
AWS_REGION="us-east-1"
ECR_REPOSITORY="pluto-app"
IMAGE_TAG="latest"
ECR_REGISTRY="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com"
ECR_IMAGE_URI="${ECR_REGISTRY}/${ECR_REPOSITORY}:${IMAGE_TAG}"
echo "🚀 Starting Pluto App upload to ECR..."
echo "📦 Target: ${ECR_IMAGE_URI}"
echo ""
# Check prerequisites
echo "📋 Checking prerequisites..."
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed or not running"
exit 1
fi
if ! command -v aws &> /dev/null; then
echo "❌ AWS CLI is not installed"
exit 1
fi
echo "✅ Prerequisites check passed"
# Authenticate with ECR
echo "🔐 Authenticating with AWS ECR..."
aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${ECR_REGISTRY}
if [ $? -ne 0 ]; then
echo "❌ ECR authentication failed"
exit 1
fi
echo "✅ ECR authentication successful"
# Build Docker image
echo "🏗️ Building Docker image..."
docker build -t ${ECR_IMAGE_URI} -t pluto-app:latest .
if [ $? -ne 0 ]; then
echo "❌ Docker build failed"
exit 1
fi
echo "✅ Docker image built successfully"
# Push to ECR
echo "🚀 Pushing image to ECR..."
docker push ${ECR_IMAGE_URI}
if [ $? -ne 0 ]; then
echo "❌ Docker push failed"
exit 1
fi
echo "✅ Image pushed successfully to ECR"
echo ""
echo "🎉 Upload completed successfully!"
echo "📍 Image available at: ${ECR_IMAGE_URI}"
echo "💡 The ECS service will automatically deploy the new image."