Download backend/deploy_cloudrun.sh from bapi143/CropAI: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/bapi143/CropAI/resolve/main/backend/deploy_cloudrun.sh
- Command line
-
hf download hf://spaces/bapi143/CropAI/backend/deploy_cloudrun.sh
-
curl -L -o deploy_cloudrun.sh https://huggingface.co/spaces/bapi143/CropAI/resolve/main/backend/deploy_cloudrun.sh
1.19 kB
| # Deploy CropAI Backend to Google Cloud Run | |
| set -e | |
| PROJECT_ID=${1:-"$(gcloud config get-value project)"} | |
| REGION=${2:-"us-central1"} | |
| SERVICE_NAME="cropai-backend" | |
| IMAGE_NAME="gcr.io/${PROJECT_ID}/${SERVICE_NAME}:latest" | |
| echo "==================================================" | |
| echo "Deploying CropAI Backend to Google Cloud Run" | |
| echo "Project: $PROJECT_ID | Region: $REGION" | |
| echo "==================================================" | |
| # 1. Build container image using Google Cloud Build | |
| echo "[1/3] Building container image on Cloud Build..." | |
| gcloud builds submit --tag ${IMAGE_NAME} . | |
| # 2. Deploy to Cloud Run | |
| echo "[2/3] Deploying to Cloud Run..." | |
| gcloud run deploy ${SERVICE_NAME} \ | |
| --image ${IMAGE_NAME} \ | |
| --platform managed \ | |
| --region ${REGION} \ | |
| --allow-unauthenticated \ | |
| --memory 2Gi \ | |
| --cpu 2 \ | |
| --min-instances 0 \ | |
| --max-instances 10 \ | |
| --port 8080 | |
| # 3. Retrieve service URL | |
| SERVICE_URL=$(gcloud run services describe ${SERVICE_NAME} --platform managed --region ${REGION} --format 'value(status.url)') | |
| echo "[3/3] Deployment complete!" | |
| echo "CropAI API Endpoint: ${SERVICE_URL}" | |
| echo "Test endpoint: ${SERVICE_URL}/health" | |