# Cloud Build configuration for deploying to Cloud Run
steps:
# Build the Docker image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/${_REPO_NAME}/${_SERVICE_NAME}:${SHORT_SHA}'
- '-t'
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/${_REPO_NAME}/${_SERVICE_NAME}:latest'
- '.'
# Push the image to Artifact Registry
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- '--all-tags'
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/${_REPO_NAME}/${_SERVICE_NAME}'
# Deploy to Cloud Run
# Configuration optimized for Playwright/Chromium scraping
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: 'gcloud'
args:
- 'run'
- 'deploy'
- '${_SERVICE_NAME}'
- '--image'
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/${_REPO_NAME}/${_SERVICE_NAME}:${SHORT_SHA}'
- '--region'
- '${_REGION}'
- '--platform'
- 'managed'
# Playwright/Chromium requirements:
# - 2Gi memory: Chromium alone needs 500MB-1GB
# - 2 CPUs: Browser performance suffers with 1 CPU
# - Gen2: Real Linux kernel instead of gVisor sandbox (better syscall support)
- '--memory'
- '2Gi'
- '--cpu'
- '2'
- '--execution-environment'
- 'gen2'
- '--timeout'
- '300s'
- '--min-instances'
- '0'
- '--max-instances'
- '10'
# Low concurrency: Each browser instance is resource-intensive
# With 2Gi/2CPU, 5-10 concurrent requests is reasonable
- '--concurrency'
- '10'
- '--no-allow-unauthenticated'
- '--set-env-vars'
- 'NODE_ENV=production,MCP_TRANSPORT=http,GOOGLE_CLOUD_PROJECT=${PROJECT_ID}'
# Substitution variables (can be overridden)
substitutions:
_REGION: 'europe-north1'
_REPO_NAME: 'alko-mcp'
_SERVICE_NAME: 'alko-mcp'
# Store images in Artifact Registry
images:
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/${_REPO_NAME}/${_SERVICE_NAME}:${SHORT_SHA}'
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/${_REPO_NAME}/${_SERVICE_NAME}:latest'
# Build timeout
timeout: '1200s'
# Build options
options:
logging: CLOUD_LOGGING_ONLY