-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy_cloudrun.sh
More file actions
executable file
·39 lines (32 loc) · 1.11 KB
/
Copy pathdeploy_cloudrun.sh
File metadata and controls
executable file
·39 lines (32 loc) · 1.11 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
#!/bin/bash
set -e
# Load .env
if [ -f procurement/.env ]; then
export $(grep -v '^#' procurement/.env | xargs)
fi
PROJECT_ID=${GOOGLE_CLOUD_PROJECT}
REGION=${GOOGLE_CLOUD_LOCATION:-us-central1}
SERVICE_NAME="procurement-agent-cloudrun"
IMAGE_NAME="gcr.io/$PROJECT_ID/$SERVICE_NAME"
echo "🚀 Deploying Agent to Cloud Run..."
echo " Project: $PROJECT_ID"
echo " Region: $REGION"
if [ -z "$MONGODB_URI" ]; then
echo "⚠️ MONGODB_URI is not set. Persistence will be disabled."
fi
# Build
echo "📦 Building Container..."
gcloud builds submit --tag $IMAGE_NAME --project $PROJECT_ID .
# Deploy
echo "🚀 Deploying Service..."
gcloud run deploy $SERVICE_NAME \
--image $IMAGE_NAME \
--platform managed \
--region $REGION \
--project $PROJECT_ID \
--allow-unauthenticated \
--set-env-vars MONGODB_URI="$MONGODB_URI" \
--set-env-vars MONGODB_DATABASE="$MONGODB_DATABASE" \
--set-env-vars GOOGLE_CLOUD_PROJECT=$PROJECT_ID
echo "✅ Deployment Complete!"
echo " Service URL: $(gcloud run services describe $SERVICE_NAME --platform managed --region $REGION --format 'value(status.url)')"