cloudbuild.yamlβ’2.77 kB
# Google Cloud Build configuration for deploying MCP server to Cloud Run
#
# This file automates the build and deployment process:
# 1. Builds the Docker container image
# 2. Pushes it to Google Container Registry (GCR)
# 3. Deploys it to Cloud Run
#
# To use this file:
# gcloud builds submit --config cloudbuild.yaml
steps:
# Build the container image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'europe-west2-docker.pkg.dev/$PROJECT_ID/mcp-docker-repo/mcp-timezone-server:$BUILD_ID'
- '-t'
- 'europe-west2-docker.pkg.dev/$PROJECT_ID/mcp-docker-repo/mcp-timezone-server:latest'
- '.'
# Authenticate to Artifact Registry
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: 'bash'
args:
- '-c'
- 'gcloud auth configure-docker europe-west2-docker.pkg.dev --quiet'
# Push the container image to Artifact Registry
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- '--all-tags'
- 'europe-west2-docker.pkg.dev/$PROJECT_ID/mcp-docker-repo/mcp-timezone-server'
# Deploy container image to Cloud Run
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args:
- 'run'
- 'deploy'
- 'mcp-timezone-server'
- '--image'
- 'europe-west2-docker.pkg.dev/$PROJECT_ID/mcp-docker-repo/mcp-timezone-server:$BUILD_ID'
- '--region'
- 'europe-west2'
- '--platform'
- 'managed'
- '--allow-unauthenticated' # Make the service publicly accessible
- '--port'
- '8080'
- '--memory'
- '512Mi'
- '--cpu'
- '1'
- '--min-instances'
- '0'
- '--max-instances'
- '1'
- '--timeout'
- '300'
# Environment variables (non-sensitive)
- '--set-env-vars'
- 'NODE_ENV=production,MCP_TRANSPORT=http,JWT_EXPIRES_IN=3600,MCP_AUTH_SERVER_URL=https://mcp-timezone-server-3merqrrryq-nw.a.run.app'
# Secrets from Google Secret Manager
# Note: Secrets need to be created/updated in Secret Manager:
# - mcp-auth-client-id (Google OAuth client ID)
# - mcp-auth-client-secret (Google OAuth client secret)
# - mcp-auth-jwt-secret (JWT signing secret)
# - allowed-emails (comma-separated list)
- '--update-secrets'
- 'MCP_AUTH_CLIENT_ID=mcp-auth-client-id:latest,MCP_AUTH_CLIENT_SECRET=mcp-auth-client-secret:latest,MCP_AUTH_JWT_SECRET=mcp-auth-jwt-secret:latest,ALLOWED_EMAILS=allowed-emails:latest'
images:
- 'europe-west2-docker.pkg.dev/$PROJECT_ID/mcp-docker-repo/mcp-timezone-server:$BUILD_ID'
- 'europe-west2-docker.pkg.dev/$PROJECT_ID/mcp-docker-repo/mcp-timezone-server:latest'
options:
machineType: 'N1_HIGHCPU_8'
logging: CLOUD_LOGGING_ONLY