Deploy to Google Cloud

Run the kit on Cloud Run.

The Google Cloud kit runs your model on Cloud Run. Download it from the Deploy anywhere tab of the Deploy & export panel, on the Google Cloud Run card, and unzip it. The README.md inside has these commands with your model's name and tag filled in. If you have not used a kit before, read Choose where to deploy.

You need the gcloud CLI signed in to a project with billing enabled, and Docker. Values in angle brackets are yours to fill in. my-model and v-1 stand for the image name and tag in your kit's README.

Push the image to Artifact Registry

Create a Docker repository in Artifact Registry, let Docker authenticate to it, then build and push.

bash
export PROJECT_ID=<PROJECT_ID>
export REGION=<REGION>
export REPO=<ARTIFACT_REGISTRY_REPO>
export IMAGE=$REGION-docker.pkg.dev/$PROJECT_ID/$REPO/my-model:v-1

gcloud artifacts repositories create $REPO --repository-format=docker --location=$REGION --project=$PROJECT_ID
gcloud auth configure-docker $REGION-docker.pkg.dev
docker build -t $IMAGE .
docker push $IMAGE

Deploy to Cloud Run

bash
gcloud run deploy my-model --image $IMAGE --region $REGION --project $PROJECT_ID \
  --port 8080 --memory 2Gi --cpu 1 --min-instances 0 --max-instances 5 \
  --no-allow-unauthenticated

This gives each instance 1 CPU and 2 GiB of memory and scales from zero to five instances. With --min-instances 0 the service costs nothing while idle, but the first request after a quiet period waits for an instance to start and the model to load. Set --min-instances 1 if that delay matters.

Keep the service private

--no-allow-unauthenticated means Cloud Run checks a Google identity on every request. The prediction service has no authentication of its own, so use --allow-unauthenticated only if the model is meant to be public.

Declarative alternative

The kit includes deploy/gcp-cloudrun/service.yaml. Fill in <REGION>, <PROJECT_ID> and <ARTIFACT_REGISTRY_REPO> in the image line, then run:

bash
gcloud run services replace deploy/gcp-cloudrun/service.yaml --region $REGION

The file sets the same limits, a concurrency of 20 requests per instance, a startup probe and a liveness probe on /health.

Call the endpoint

Get the service address and call it with an identity token from your own account:

bash
SERVICE_URL=$(gcloud run services describe my-model --region $REGION --format 'value(status.url)')

curl -H "Authorization: Bearer $(gcloud auth print-identity-token)" $SERVICE_URL/health

curl -X POST $SERVICE_URL/predict \
  -H "Authorization: Bearer $(gcloud auth print-identity-token)" \
  -H "Content-Type: application/json" \
  -d @sample.json

Your account needs the Cloud Run Invoker role on the service. For another service to call the model, give its service account the same role. The answer has a predictions list, and classification models add probabilities and classes. Requests are limited to 5 MB and 1,000 records. The routes and error codes are in Deploy with Docker.

Next steps

Updated 2026-11-22