Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
fwfutures avatar

Gcp Deploy

  • 11 installs
  • Updated March 18, 2026
  • fwfutures/vibe-a-thon

Deploy containerised apps to Google Cloud Run from source with gcloud, including env vars, secrets, logs and troubleshooting.

About

Deploys applications from source to Google Cloud Run in a single gcloud command, covering setup, env/secrets and log inspection. A developer uses it to ship or redeploy a Cloud Run service.

  • Single-command source-to-Cloud-Run deploy via gcloud
  • Covers API enablement, env vars, secrets and logs

Gcp Deploy by the numbers

  • 11 all-time installs (skills.sh)
  • Ranked #993 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
  • Data as of Jul 24, 2026 (Skillselion catalog sync)
npx skills add https://github.com/fwfutures/vibe-a-thon --skill gcp-deploy

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs11
Last updatedMarch 18, 2026
Repositoryfwfutures/vibe-a-thon

What it does

Deploy containerised apps to Google Cloud Run from source with gcloud, including env vars, secrets, logs and troubleshooting.

Files

SKILL.mdMarkdownGitHub ↗

GCP Cloud Run Deploy

Deploy from source to Cloud Run in a single command. Requires: a GCP project, a Dockerfile in the repo root, and an app that listens on a port (default 8080 / PORT env var).

Quick Deploy

# 1. Auth (skip if already logged in)
gcloud auth login
gcloud config set project PROJECT_ID

# 2. Enable APIs (first time only)
gcloud services enable run.googleapis.com cloudbuild.googleapis.com artifactregistry.googleapis.com

# 3. Deploy
gcloud run deploy SERVICE_NAME \
  --source . \
  --region australia-southeast1 \
  --allow-unauthenticated

This builds the container remotely via Cloud Build, pushes to Artifact Registry, deploys to Cloud Run, and returns a public HTTPS URL. Redeploy by re-running the same command.

Deploy Script

Copy scripts/deploy.sh into the project root for one-command deploys:

chmod +x deploy.sh
./deploy.sh my-service

Env vars: GCP_REGION (default australia-southeast1), GCP_PROJECT (default: current gcloud project).

Common Flags

FlagPurposeExample
--regionDeployment regionaustralia-southeast1
--allow-unauthenticatedPublic access
--portContainer port (if not 8080)--port 3000
--set-env-varsEnv vars--set-env-vars KEY=val,FOO=bar
--set-secretsSecret Manager secrets--set-secrets ENV=SECRET:latest
--memoryMemory--memory 512Mi
--cpuCPU--cpu 1
--min-instancesMin instances (0 = scale to zero)--min-instances 0
--max-instancesMax instances--max-instances 3
--timeoutRequest timeout (max 3600)--timeout 300

Environment Variables and Secrets

Inline env vars:

gcloud run deploy SERVICE --source . --region REGION --allow-unauthenticated \
  --set-env-vars "DATABASE_URL=postgres://...,API_KEY=abc123"

Secret Manager (recommended for sensitive values):

# Create secret
echo -n "secret-value" | gcloud secrets create MY_SECRET --data-file=-

# Grant access to default compute SA
gcloud secrets add-iam-policy-binding MY_SECRET \
  --member="serviceAccount:$(gcloud iam service-accounts list --format='value(email)' --filter='displayName:Compute Engine default')" \
  --role="roles/secretmanager.secretAccessor"

# Deploy with secret
gcloud run deploy SERVICE --source . --region REGION --allow-unauthenticated \
  --set-secrets "MY_SECRET=MY_SECRET:latest"

Useful Commands

# Stream logs
gcloud run services logs tail SERVICE --region REGION

# List services
gcloud run services list --region REGION

# Get service URL
gcloud run services describe SERVICE --region REGION --format "value(status.url)"

# Delete service
gcloud run services delete SERVICE --region REGION

Build Failure Diagnostics (Cloud Run --source)

When gcloud run deploy --source . fails with a generic "Build failed" message, inspect Cloud Build directly:

# 1) List recent builds (global default)
gcloud builds list --limit=10 --sort-by=~createTime

# 2) Show details, including logUrl and per-step status
gcloud builds describe BUILD_ID

# 3) Stream logs for that build
gcloud builds log BUILD_ID --stream

For regional/2nd-gen build resources, include --region:

gcloud builds list --region REGION --limit=10 --sort-by=~createTime
gcloud builds describe BUILD_ID --region REGION
gcloud builds log BUILD_ID --region REGION --stream

If no build is visible after a failed source deploy, run an explicit build to surface the exact Docker push/build error:

gcloud builds submit --tag REGION-docker.pkg.dev/PROJECT_ID/REPO/IMAGE:debug

CI/Headless Auth

gcloud auth activate-service-account --key-file=key.json
gcloud config set project PROJECT_ID

Troubleshooting

IssueFix
Build fails (generic from run deploy)Use gcloud builds list, gcloud builds describe BUILD_ID, and gcloud builds log BUILD_ID --stream
Build cannot push image (artifactregistry.repositories.uploadArtifacts denied)Grant build SA roles/artifactregistry.writer on project/repo; if needed also grant roles/logging.logWriter
403 on deployNeed roles/run.admin and roles/cloudbuild.builds.editor
App crashes on startCheck logs: gcloud run services logs tail SERVICE --region REGION
Port mismatchSet --port to match app, or have app read PORT env var
Cold start slowSet --min-instances 1 (stays warm, costs more)
Timeout on long requestsIncrease with --timeout 300 (max 3600s)

IAM fix for Artifact Registry push failures

PROJECT_ID=your-project-id
PROJECT_NUMBER=$(gcloud projects describe "$PROJECT_ID" --format='value(projectNumber)')

# Build SA may be compute default in newer projects
BUILD_SA="$PROJECT_NUMBER-compute@developer.gserviceaccount.com"

gcloud projects add-iam-policy-binding "$PROJECT_ID" \
  --member="serviceAccount:$BUILD_SA" \
  --role="roles/artifactregistry.writer"

gcloud projects add-iam-policy-binding "$PROJECT_ID" \
  --member="serviceAccount:$BUILD_SA" \
  --role="roles/logging.logWriter"

If your project uses the Cloud Build legacy SA, grant the same roles to: $PROJECT_NUMBER@cloudbuild.gserviceaccount.com.

Related skills

DevOps & CI/CDdeployinfra

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.