Gemini Skill: Centralized Deployments via Artifact Registry
This skill file documents the rules and commands for deploying services (Cloud Run, Cloud Functions) and Vertex AI Agents using centralized locations to prevent bucket sprawl.
Repository (Docker Images)
us-central1-docker.pkg.dev/analytics-386417/central-deployments
Central Staging Bucket (For Vertex AI Agents)
gs://analytics-386417-agent-staging
Rules
- Avoid Source Buckets: Do not use
gcloud run deploy --sourceorgcloud functions deploy --sourcedirectly if it causes auto-generated staging buckets. Prefer building images first. - Use Image-Based Deployment: The recommended approach for Cloud Run and Functions is to build container images using Cloud Build, store them in the centralized Artifact Registry, and then deploy from the registry.
- Vertex AI Agents:
- Prefer Inline Source Deployment: Avoid creating staging buckets entirely if supported.
- Use Central Staging Bucket: If you must use a staging bucket, always use
gs://analytics-386417-agent-staging.
Usage Commands
1. Build and Push Image using Cloud Build
Run this command from the directory containing the Dockerfile (e.g., mcp-gateway/):
gcloud builds submit --tag us-central1-docker.pkg.dev/analytics-386417/central-deployments/SERVICE_NAME:TAG
Replace SERVICE_NAME with the name of your service and TAG with a version or latest.
2. Deploy to Cloud Run from Artifact Registry
Once the image is built, deploy it to Cloud Run:
gcloud run deploy SERVICE_NAME \
--image us-central1-docker.pkg.dev/analytics-386417/central-deployments/SERVICE_NAME:TAG \
--region us-central1 \
--project analytics-386417 \
--no-allow-unauthenticated
3. Cloud Functions (Gen 2)
For Cloud Functions Gen 2, you can also use container images if you package your function as a web service, or use the --stage-bucket flag pointing to a single central bucket if you must use source-based deployment.
4. Vertex AI Agent Deployment (Python SDK)
If you must use a staging bucket when initializing the SDK:
import vertexai
vertexai.init(project="analytics-386417", location="us-central1", staging_bucket="gs://analytics-386417-agent-staging")