| $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 |