Repository navigation
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·59 lines (49 loc) · 1.53 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·59 lines (49 loc) · 1.53 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
#!/bin/bash
# Deployment script for Cloud Run
set -e
# Configuration
PROJECT_ID=${1:-"your-project-id"}
SERVICE_NAME="codebase-time-machine"
REGION="us-central1"
IMAGE_NAME="gcr.io/$PROJECT_ID/$SERVICE_NAME"
echo "🕐 Deploying Codebase Time Machine to Cloud Run..."
echo "📋 Project ID: $PROJECT_ID"
echo "🌍 Region: $REGION"
# Check if gcloud is installed
if ! command -v gcloud &> /dev/null; then
echo "❌ gcloud CLI is not installed. Please install it first:"
echo "https://cloud.google.com/sdk/docs/install"
exit 1
fi
# Set project
echo "🔧 Setting project..."
gcloud config set project $PROJECT_ID
# Enable required APIs
echo "🔌 Enabling required APIs..."
gcloud services enable cloudbuild.googleapis.com
gcloud services enable run.googleapis.com
gcloud services enable containerregistry.googleapis.com
# Build and push using Cloud Build
echo "🏗️ Building container with Cloud Build..."
gcloud builds submit --tag $IMAGE_NAME
# Deploy to Cloud Run
echo "🚀 Deploying to Cloud Run..."
gcloud run deploy $SERVICE_NAME \
--image $IMAGE_NAME \
--platform managed \
--region $REGION \
--allow-unauthenticated \
--port 8501 \
--memory 2Gi \
--cpu 2 \
--max-instances 10 \
--concurrency 80 \
--timeout 3600
# Get the service URL
SERVICE_URL=$(gcloud run services describe $SERVICE_NAME --region $REGION --format 'value(status.url)')
echo ""
echo "✅ Deployment complete!"
echo "🌐 Your app is live at: $SERVICE_URL"
echo ""
echo "📱 To update the deployment, run:"
echo " ./deploy.sh $PROJECT_ID"