File size: 1,142 Bytes
3091d31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
$PROJECT_ID = "buddy-math-dev"
$SERVICE_NAME = "buddy-math-server"
$REGION = "europe-west3" 
$IMAGE_NAME = "gcr.io/$PROJECT_ID/$SERVICE_NAME"

Write-Host "--- Starting Deployment for BuddyMath Server (DEV) ---" -ForegroundColor Cyan

# 1. Check for gcloud
if (!(Get-Command gcloud -ErrorAction SilentlyContinue)) {
    Write-Error "❌ gcloud CLI not found."
    exit
}

# 2. Set Project
gcloud config set project $PROJECT_ID

# 3. Build Image
Write-Host "Building Image..."
gcloud builds submit --tag $IMAGE_NAME .

# 4. Deploy to Cloud Run (Single Line Command to avoid Backtick errors)
Write-Host "Deploying to Cloud Run..."
gcloud run deploy $SERVICE_NAME --image $IMAGE_NAME --platform managed --region $REGION --allow-unauthenticated --set-env-vars "ENV=development,OCR_STRIP_MODE=development"

Write-Host "Deployment Complete!" -ForegroundColor Green

# 5. Storage Lifecycle Rule
Write-Host "Applying Storage Lifecycle Rule..." -ForegroundColor Yellow
gcloud storage buckets update gs://buddy-math-dev.firebasestorage.app --lifecycle-file=gcs_lifecycle_rule.json

Write-Host "DONE: Everything is up and running!" -ForegroundColor Green