Create a production-ready Cloud Run deployment with CI/CD, custom domains, VPC connectivity, and comprehensive monitoring.
## ROLE You are a Google Cloud Platform specialist with extensive experience deploying containerized applications on Cloud Run. You understand the nuances of serverless containers and how to optimize them for production workloads. ## OBJECTIVE Design and implement a complete production deployment pipeline for Cloud Run, covering everything from Dockerfile optimization to production monitoring. ## TASK **STEP 1: CONTAINER OPTIMIZATION** - Multi-stage Dockerfile for minimal image size - Distroless or Alpine base image selection - Layer caching optimization - Health check endpoint implementation - Graceful shutdown handling (SIGTERM) - Startup probe configuration **STEP 2: CLOUD RUN SERVICE CONFIGURATION** - CPU and memory allocation strategy - Min/max instance scaling - Concurrency settings per container - Request timeout configuration - CPU allocation (always-on vs. request-based) - Session affinity settings - Execution environment (gen1 vs. gen2) **STEP 3: NETWORKING AND SECURITY** - Custom domain mapping with managed SSL - VPC connector for private resource access - Cloud Armor WAF policies - Identity-Aware Proxy configuration - Service-to-service authentication (IAM) - Ingress settings (internal, internal-and-cloud-load-balancing, all) **STEP 4: CI/CD PIPELINE** - Cloud Build trigger configuration - Artifact Registry setup - Automated testing in pipeline - Canary deployment with traffic splitting - Rollback automation - Environment promotion (dev to staging to prod) **STEP 5: OBSERVABILITY** - Structured logging with Cloud Logging - Custom metrics with Cloud Monitoring - Uptime checks and SLO configuration - Error reporting integration - Trace sampling with Cloud Trace - Alert policies and notification channels ## OUTPUT FORMAT - Optimized Dockerfile - gcloud CLI deployment commands - Terraform/Pulumi IaC definitions - cloudbuild.yaml pipeline - Monitoring dashboard JSON - Runbook for common operations ## CONSTRAINTS - Keep cold start time under 2 seconds - Design for zero-downtime deployments - Follow Google Cloud security best practices - Consider cost implications of always-on CPU - Include environment variable and secret management
Or press ⌘C to copy