#!/usr/bin/env bash set -euo pipefail if [ -z "${PROJECT_ID:-}" ]; then echo "Error: PROJECT_ID is not set." echo "Usage: PROJECT_ID=your-gcp-project-id bash deploy.sh" exit 1 fi if ! gcloud auth print-identity-token &>/dev/null; then echo "Error: gcloud is not authenticated. Run: gcloud auth login" exit 1 fi IMAGE="gcr.io/${PROJECT_ID}/signlink" echo "Building Docker image…" docker build -f Dockerfile.cloudrun -t "${IMAGE}" . echo "Pushing to Google Container Registry…" docker push "${IMAGE}" echo "Deploying to Cloud Run…" gcloud run deploy signlink \ --image "${IMAGE}" \ --platform managed \ --region us-central1 \ --memory 2Gi \ --allow-unauthenticated echo "" echo "Deployed. Service URL:" gcloud run services describe signlink \ --platform managed \ --region us-central1 \ --format 'value(status.url)'