# Centralized Deployments

> Gemini Skill: Centralized Deployments via Artifact Registry

- Skill: `izzyfresh/centralized-deployments` (Agent Skill)
- Install (CLI): `npx skillmds@latest add izzyfresh/centralized-deployments`
- Raw SKILL.md: https://api.skillmd.com/api/skills/izzyfresh/centralized-deployments/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: IzzyFresh (https://skillmd.com/u/izzyfresh)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/izzyfresh/centralized-deployments

---

# 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
1.  **Avoid Source Buckets:** Do not use `gcloud run deploy --source` or `gcloud functions deploy --source` directly if it causes auto-generated staging buckets. Prefer building images first.
2.  **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.
3.  **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/`):
```bash
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:
```bash
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:
```python
import vertexai
vertexai.init(project="analytics-386417", location="us-central1", staging_bucket="gs://analytics-386417-agent-staging")
```

