DevOps Skill
Comprehensive guide for deploying and managing cloud infrastructure across Cloudflare edge platform, Docker containerization, and Google Cloud Platform.
When to Use This Skill
Use this skill when:
- Deploying serverless applications to Cloudflare Workers
- Containerizing applications with Docker
- Managing Google Cloud infrastructure with gcloud CLI
- Setting up CI/CD pipelines across platforms
- Optimizing cloud infrastructure costs
- Implementing multi-region deployments
- Building edge-first architectures
- Managing container orchestration with Kubernetes
- Configuring cloud storage solutions (R2, Cloud Storage)
- Automating infrastructure with scripts and IaC
Platform Selection Guide
When to Use Cloudflare
Best For:
- Edge-first applications with global distribution
- Ultra-low latency requirements (<50ms)
- Static sites with serverless functions
- Zero egress cost scenarios (R2 storage)
- WebSocket/real-time applications (Durable Objects)
- AI/ML at the edge (Workers AI)
Key Products:
- Workers (serverless functions)
- R2 (object storage, S3-compatible)
- D1 (SQLite database with global replication)
- KV (key-value store)
- Pages (static hosting + functions)
- Durable Objects (stateful compute)
- Browser Rendering (headless browser automation)
Cost Profile: Pay-per-request, generous free tier, zero egress fees
When to Use Docker
Best For:
- Local development consistency
- Microservices architectures
- Multi-language stack applications
- Traditional VPS/VM deployments
- Kubernetes orchestration
- CI/CD build environments
- Database containerization (dev/test)
Key Capabilities:
- Application isolation and portability
- Multi-stage builds for optimization
- Docker Compose for multi-container apps
- Volume management for data persistence
- Network configuration and service discovery
- Cross-platform compatibility (amd64, arm64)
Cost Profile: Infrastructure cost only (compute + storage)
When to Use Google Cloud
Best For:
- Enterprise-scale applications
- Data analytics and ML pipelines (BigQuery, Vertex AI)
- Hybrid/multi-cloud deployments
- Kubernetes at scale (GKE)
- Managed databases (Cloud SQL, Firestore, Spanner)
- Complex IAM and compliance requirements
Key Services:
- Compute Engine (VMs)
- GKE (managed Kubernetes)
- Cloud Run (containerized serverless)
- App Engine (PaaS)
- Cloud Storage (object storage)
- Cloud SQL (managed databases)
Cost Profile: Varied pricing, sustained use discounts, committed use contracts
Quick Start
Cloudflare Workers
# Install Wrangler CLI
npm install -g wrangler
# Create and deploy Worker
wrangler init my-worker
cd my-worker
wrangler deploy
See: references/cloudflare-workers-basics.md
Docker Container
# Create Dockerfile
cat > Dockerfile <<EOF
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --production
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]
EOF
# Build and run
docker build -t myapp .
docker run -p 3000:3000 myapp
See: references/docker-basics.md
Google Cloud Deployment
# Install and authenticate
curl https://sdk.cloud.google.com | bash
gcloud init
gcloud auth login
# Deploy to Cloud Run
gcloud run deploy my-service \
--image gcr.io/project/image \
--region us-central1
See: references/gcloud-platform.md
Reference Navigation
Cloudflare Platform
cloudflare-platform.md - Edge computing overview, key components
cloudflare-workers-basics.md - Getting started, handler types, basic patterns
cloudflare-workers-advanced.md - Advanced patterns, performance, optimization
cloudflare-workers-apis.md - Runtime APIs, bindings, integrations
cloudflare-r2-storage.md - R2 object storage, S3 compatibility, best practices
cloudflare-d1-kv.md - D1 SQLite database, KV store, use cases
browser-rendering.md - Puppeteer/Playwright automation on Cloudflare
Docker Containerization
docker-basics.md - Core concepts, Dockerfile, images, containers
docker-compose.md - Multi-container apps, networking, volumes
Google Cloud Platform
gcloud-platform.md - GCP overview, gcloud CLI, authentication
gcloud-services.md - Compute Engine, GKE, Cloud Run, App Engine
Python Utilities
scripts/cloudflare-deploy.py - Automate Cloudflare Worker deployments
scripts/docker-optimize.py - Analyze and optimize Dockerfiles
Common Workflows
Edge + Container Hybrid
# Cloudflare Workers (API Gateway)
# -> Docker containers on Cloud Run (Backend Services)
# -> R2 (Object Storage)
# Benefits:
# - Edge caching and routing
# - Containerized business logic
# - Global distribution
Multi-Stage Docker Build
# Build stage
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Production stage
FROM node:20-alpine
WORKDIR /app
COPY --from=build /app/dist ./dist
COPY --from=build /app/node_modules ./node_modules
USER node
CMD ["node", "dist/server.js"]
CI/CD Pipeline Pattern
# 1. Build: Docker multi-stage build
# 2. Test: Run tests in container
# 3. Push: Push to registry (GCR, Docker Hub)
# 4. Deploy: Deploy to Cloudflare Workers / Cloud Run
# 5. Verify: Health checks and smoke tests
Best Practices
Security
- Run containers as non-root user
- Use service account impersonation (GCP)
- Store secrets in environment variables, not code
- Scan images for vulnerabilities (Docker Scout)
- Use API tokens with minimal permissions
Performance
- Multi-stage Docker builds to reduce image size
- Edge caching with Cloudflare KV
- Use R2 for zero egress cost storage
- Implement health checks for containers
- Set appropriate timeouts and resource limits
Cost Optimization
- Use Cloudflare R2 instead of S3 for large egress
- Implement caching strategies (edge + KV)
- Right-size container resources
- Use sustained use discounts (GCP)
- Monitor usage with cloud provider dashboards
Development
- Use Docker Compose for local development
- Wrangler dev for local Worker testing
- Named gcloud configurations for multi-environment
- Version control infrastructure code
- Implement automated testing in CI/CD
Decision Matrix
| Need |
Choose |
| Sub-50ms latency globally |
Cloudflare Workers |
| Large file storage (zero egress) |
Cloudflare R2 |
| SQL database (global reads) |
Cloudflare D1 |
| Containerized workloads |
Docker + Cloud Run/GKE |
| Enterprise Kubernetes |
GKE |
| Managed relational DB |
Cloud SQL |
| Static site + API |
Cloudflare Pages |
| WebSocket/real-time |
Cloudflare Durable Objects |
| ML/AI pipelines |
GCP Vertex AI |
| Browser automation |
Cloudflare Browser Rendering |
Resources
Implementation Checklist
Cloudflare Workers
Docker
Google Cloud
1---2name: devops3description: Deploy and manage cloud infrastructure on Cloudflare (Workers, R2, D1, KV, Pages, Durable Objects, Browser Rendering), Docker containers, and Google Cloud Platform (Compute Engine, GKE, Cloud Run, App Engine, Cloud Storage). Use when deploying serverless functions to the edge, configuring edge computing solutions, managing Docker containers and images, setting up CI/CD pipelines, optimizing cloud infrastructure costs, implementing global caching strategies, working with cloud databases, or building cloud-native applications.4license: MIT5---67# DevOps Skill89Comprehensive guide for deploying and managing cloud infrastructure across Cloudflare edge platform, Docker containerization, and Google Cloud Platform.1011## When to Use This Skill1213Use this skill when:14- Deploying serverless applications to Cloudflare Workers15- Containerizing applications with Docker16- Managing Google Cloud infrastructure with gcloud CLI17- Setting up CI/CD pipelines across platforms18- Optimizing cloud infrastructure costs19- Implementing multi-region deployments20- Building edge-first architectures21- Managing container orchestration with Kubernetes22- Configuring cloud storage solutions (R2, Cloud Storage)23- Automating infrastructure with scripts and IaC2425## Platform Selection Guide2627### When to Use Cloudflare2829**Best For:**30- Edge-first applications with global distribution31- Ultra-low latency requirements (<50ms)32- Static sites with serverless functions33- Zero egress cost scenarios (R2 storage)34- WebSocket/real-time applications (Durable Objects)35- AI/ML at the edge (Workers AI)3637**Key Products:**38- Workers (serverless functions)39- R2 (object storage, S3-compatible)40- D1 (SQLite database with global replication)41- KV (key-value store)42- Pages (static hosting + functions)43- Durable Objects (stateful compute)44- Browser Rendering (headless browser automation)4546**Cost Profile:** Pay-per-request, generous free tier, zero egress fees4748### When to Use Docker4950**Best For:**51- Local development consistency52- Microservices architectures53- Multi-language stack applications54- Traditional VPS/VM deployments55- Kubernetes orchestration56- CI/CD build environments57- Database containerization (dev/test)5859**Key Capabilities:**60- Application isolation and portability61- Multi-stage builds for optimization62- Docker Compose for multi-container apps63- Volume management for data persistence64- Network configuration and service discovery65- Cross-platform compatibility (amd64, arm64)6667**Cost Profile:** Infrastructure cost only (compute + storage)6869### When to Use Google Cloud7071**Best For:**72- Enterprise-scale applications73- Data analytics and ML pipelines (BigQuery, Vertex AI)74- Hybrid/multi-cloud deployments75- Kubernetes at scale (GKE)76- Managed databases (Cloud SQL, Firestore, Spanner)77- Complex IAM and compliance requirements7879**Key Services:**80- Compute Engine (VMs)81- GKE (managed Kubernetes)82- Cloud Run (containerized serverless)83- App Engine (PaaS)84- Cloud Storage (object storage)85- Cloud SQL (managed databases)8687**Cost Profile:** Varied pricing, sustained use discounts, committed use contracts8889## Quick Start9091### Cloudflare Workers9293```bash94# Install Wrangler CLI95npm install -g wrangler9697# Create and deploy Worker98wrangler init my-worker99cd my-worker100wrangler deploy101```102103See: `references/cloudflare-workers-basics.md`104105### Docker Container106107```bash108# Create Dockerfile109cat > Dockerfile <<EOF110FROM node:20-alpine111WORKDIR /app112COPY package*.json ./113RUN npm ci --production114COPY . .115EXPOSE 3000116CMD ["node", "server.js"]117EOF118119# Build and run120docker build -t myapp .121docker run -p 3000:3000 myapp122```123124See: `references/docker-basics.md`125126### Google Cloud Deployment127128```bash129# Install and authenticate130curl https://sdk.cloud.google.com | bash131gcloud init132gcloud auth login133134# Deploy to Cloud Run135gcloud run deploy my-service \136 --image gcr.io/project/image \137 --region us-central1138```139140See: `references/gcloud-platform.md`141142## Reference Navigation143144### Cloudflare Platform145- `cloudflare-platform.md` - Edge computing overview, key components146- `cloudflare-workers-basics.md` - Getting started, handler types, basic patterns147- `cloudflare-workers-advanced.md` - Advanced patterns, performance, optimization148- `cloudflare-workers-apis.md` - Runtime APIs, bindings, integrations149- `cloudflare-r2-storage.md` - R2 object storage, S3 compatibility, best practices150- `cloudflare-d1-kv.md` - D1 SQLite database, KV store, use cases151- `browser-rendering.md` - Puppeteer/Playwright automation on Cloudflare152153### Docker Containerization154- `docker-basics.md` - Core concepts, Dockerfile, images, containers155- `docker-compose.md` - Multi-container apps, networking, volumes156157### Google Cloud Platform158- `gcloud-platform.md` - GCP overview, gcloud CLI, authentication159- `gcloud-services.md` - Compute Engine, GKE, Cloud Run, App Engine160161### Python Utilities162- `scripts/cloudflare-deploy.py` - Automate Cloudflare Worker deployments163- `scripts/docker-optimize.py` - Analyze and optimize Dockerfiles164165## Common Workflows166167### Edge + Container Hybrid168169```yaml170# Cloudflare Workers (API Gateway)171# -> Docker containers on Cloud Run (Backend Services)172# -> R2 (Object Storage)173174# Benefits:175# - Edge caching and routing176# - Containerized business logic177# - Global distribution178```179180### Multi-Stage Docker Build181182```dockerfile183# Build stage184FROM node:20-alpine AS build185WORKDIR /app186COPY package*.json ./187RUN npm ci188COPY . .189RUN npm run build190191# Production stage192FROM node:20-alpine193WORKDIR /app194COPY --from=build /app/dist ./dist195COPY --from=build /app/node_modules ./node_modules196USER node197CMD ["node", "dist/server.js"]198```199200### CI/CD Pipeline Pattern201202```yaml203# 1. Build: Docker multi-stage build204# 2. Test: Run tests in container205# 3. Push: Push to registry (GCR, Docker Hub)206# 4. Deploy: Deploy to Cloudflare Workers / Cloud Run207# 5. Verify: Health checks and smoke tests208```209210## Best Practices211212### Security213- Run containers as non-root user214- Use service account impersonation (GCP)215- Store secrets in environment variables, not code216- Scan images for vulnerabilities (Docker Scout)217- Use API tokens with minimal permissions218219### Performance220- Multi-stage Docker builds to reduce image size221- Edge caching with Cloudflare KV222- Use R2 for zero egress cost storage223- Implement health checks for containers224- Set appropriate timeouts and resource limits225226### Cost Optimization227- Use Cloudflare R2 instead of S3 for large egress228- Implement caching strategies (edge + KV)229- Right-size container resources230- Use sustained use discounts (GCP)231- Monitor usage with cloud provider dashboards232233### Development234- Use Docker Compose for local development235- Wrangler dev for local Worker testing236- Named gcloud configurations for multi-environment237- Version control infrastructure code238- Implement automated testing in CI/CD239240## Decision Matrix241242| Need | Choose |243|------|--------|244| Sub-50ms latency globally | Cloudflare Workers |245| Large file storage (zero egress) | Cloudflare R2 |246| SQL database (global reads) | Cloudflare D1 |247| Containerized workloads | Docker + Cloud Run/GKE |248| Enterprise Kubernetes | GKE |249| Managed relational DB | Cloud SQL |250| Static site + API | Cloudflare Pages |251| WebSocket/real-time | Cloudflare Durable Objects |252| ML/AI pipelines | GCP Vertex AI |253| Browser automation | Cloudflare Browser Rendering |254255## Resources256257- **Cloudflare Docs:** https://developers.cloudflare.com258- **Docker Docs:** https://docs.docker.com259- **GCP Docs:** https://cloud.google.com/docs260- **Wrangler CLI:** https://developers.cloudflare.com/workers/wrangler/261- **gcloud CLI:** https://cloud.google.com/sdk/gcloud262263## Implementation Checklist264265### Cloudflare Workers266- [ ] Install Wrangler CLI267- [ ] Create Worker project268- [ ] Configure wrangler.toml (bindings, routes)269- [ ] Test locally with `wrangler dev`270- [ ] Deploy with `wrangler deploy`271272### Docker273- [ ] Write Dockerfile with multi-stage builds274- [ ] Create .dockerignore file275- [ ] Test build locally276- [ ] Push to registry277- [ ] Deploy to target platform278279### Google Cloud280- [ ] Install gcloud CLI281- [ ] Authenticate with service account282- [ ] Create project and enable APIs283- [ ] Configure IAM permissions284- [ ] Deploy and monitor resources