File size: 853 Bytes
1e5cf85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/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)'