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 co...4license: MIT5---6# DevOps Skill78Comprehensive guide for deploying and managing cloud infrastructure across Cloudflare edge platform, Docker containerization, and Google Cloud Platform.910## When to Use This Skill1112Use this skill when:13- Deploying serverless applications to Cloudflare Workers14- Containerizing applications with Docker15- Managing Google Cloud infrastructure with gcloud CLI16- Setting up CI/CD pipelines across platforms17- Optimizing cloud infrastructure costs18- Implementing multi-region deployments19- Building edge-first architectures20- Managing container orchestration with Kubernetes21- Configuring cloud storage solutions (R2, Cloud Storage)22- Automating infrastructure with scripts and IaC2324## Platform Selection Guide2526### When to Use Cloudflare2728**Best For:**29- Edge-first applications with global distribution30- Ultra-low latency requirements (<50ms)31- Static sites with serverless functions32- Zero egress cost scenarios (R2 storage)33- WebSocket/real-time applications (Durable Objects)34- AI/ML at the edge (Workers AI)3536**Key Products:**37- Workers (serverless functions)38- R2 (object storage, S3-compatible)39- D1 (SQLite database with global replication)40- KV (key-value store)41- Pages (static hosting + functions)42- Durable Objects (stateful compute)43- Browser Rendering (headless browser automation)4445**Cost Profile:** Pay-per-request, generous free tier, zero egress fees4647### When to Use Docker4849**Best For:**50- Local development consistency51- Microservices architectures52- Multi-language stack applications53- Traditional VPS/VM deployments54- Kubernetes orchestration55- CI/CD build environments56- Database containerization (dev/test)5758**Key Capabilities:**59- Application isolation and portability60- Multi-stage builds for optimization61- Docker Compose for multi-container apps62- Volume management for data persistence63- Network configuration and service discovery64- Cross-platform compatibility (amd64, arm64)6566**Cost Profile:** Infrastructure cost only (compute + storage)6768### When to Use Google Cloud6970**Best For:**71- Enterprise-scale applications72- Data analytics and ML pipelines (BigQuery, Vertex AI)73- Hybrid/multi-cloud deployments74- Kubernetes at scale (GKE)75- Managed databases (Cloud SQL, Firestore, Spanner)76- Complex IAM and compliance requirements7778**Key Services:**79- Compute Engine (VMs)80- GKE (managed Kubernetes)81- Cloud Run (containerized serverless)82- App Engine (PaaS)83- Cloud Storage (object storage)84- Cloud SQL (managed databases)8586**Cost Profile:** Varied pricing, sustained use discounts, committed use contracts8788## Quick Start8990### Cloudflare Workers9192```bash93# Install Wrangler CLI94npm install -g wrangler9596# Create and deploy Worker97wrangler init my-worker98cd my-worker99wrangler deploy100```101102See: `references/cloudflare-workers-basics.md`103104### Docker Container105106```bash107# Create Dockerfile108cat > Dockerfile <<EOF109FROM node:20-alpine110WORKDIR /app111COPY package*.json ./112RUN npm ci --production113COPY . .114EXPOSE 3000115CMD ["node", "server.js"]116EOF117118# Build and run119docker build -t myapp .120docker run -p 3000:3000 myapp121```122123See: `references/docker-basics.md`124125### Google Cloud Deployment126127```bash128# Install and authenticate129curl https://sdk.cloud.google.com | bash130gcloud init131gcloud auth login132133# Deploy to Cloud Run134gcloud run deploy my-service \135 --image gcr.io/project/image \136 --region us-central1137```138139See: `references/gcloud-platform.md`140141## Reference Navigation142143### Cloudflare Platform144- `cloudflare-platform.md` - Edge computing overview, key components145- `cloudflare-workers-basics.md` - Getting started, handler types, basic patterns146- `cloudflare-workers-advanced.md` - Advanced patterns, performance, optimization147- `cloudflare-workers-apis.md` - Runtime APIs, bindings, integrations148- `cloudflare-r2-storage.md` - R2 object storage, S3 compatibility, best practices149- `cloudflare-d1-kv.md` - D1 SQLite database, KV store, use cases150- `browser-rendering.md` - Puppeteer/Playwright automation on Cloudflare151152### Docker Containerization153- `docker-basics.md` - Core concepts, Dockerfile, images, containers154- `docker-compose.md` - Multi-container apps, networking, volumes155156### Google Cloud Platform157- `gcloud-platform.md` - GCP overview, gcloud CLI, authentication158- `gcloud-services.md` - Compute Engine, GKE, Cloud Run, App Engine159160### Python Utilities161- `scripts/cloudflare-deploy.py` - Automate Cloudflare Worker deployments162- `scripts/docker-optimize.py` - Analyze and optimize Dockerfiles163164## Common Workflows165166### Edge + Container Hybrid167168```yaml169# Cloudflare Workers (API Gateway)170# -> Docker containers on Cloud Run (Backend Services)171# -> R2 (Object Storage)172173# Benefits:174# - Edge caching and routing175# - Containerized business logic176# - Global distribution177```178179### Multi-Stage Docker Build180181```dockerfile182# Build stage183FROM node:20-alpine AS build184WORKDIR /app185COPY package*.json ./186RUN npm ci187COPY . .188RUN npm run build189190# Production stage191FROM node:20-alpine192WORKDIR /app193COPY --from=build /app/dist ./dist194COPY --from=build /app/node_modules ./node_modules195USER node196CMD ["node", "dist/server.js"]197```198199### CI/CD Pipeline Pattern200201```yaml202# 1. Build: Docker multi-stage build203# 2. Test: Run tests in container204# 3. Push: Push to registry (GCR, Docker Hub)205# 4. Deploy: Deploy to Cloudflare Workers / Cloud Run206# 5. Verify: Health checks and smoke tests207```208209## Best Practices210211### Security212- Run containers as non-root user213- Use service account impersonation (GCP)214- Store secrets in environment variables, not code215- Scan images for vulnerabilities (Docker Scout)216- Use API tokens with minimal permissions217218### Performance219- Multi-stage Docker builds to reduce image size220- Edge caching with Cloudflare KV221- Use R2 for zero egress cost storage222- Implement health checks for containers223- Set appropriate timeouts and resource limits224225### Cost Optimization226- Use Cloudflare R2 instead of S3 for large egress227- Implement caching strategies (edge + KV)228- Right-size container resources229- Use sustained use discounts (GCP)230- Monitor usage with cloud provider dashboards231232### Development233- Use Docker Compose for local development234- Wrangler dev for local Worker testing235- Named gcloud configurations for multi-environment236- Version control infrastructure code237- Implement automated testing in CI/CD238239## Decision Matrix240241| Need | Choose |242|------|--------|243| Sub-50ms latency globally | Cloudflare Workers |244| Large file storage (zero egress) | Cloudflare R2 |245| SQL database (global reads) | Cloudflare D1 |246| Containerized workloads | Docker + Cloud Run/GKE |247| Enterprise Kubernetes | GKE |248| Managed relational DB | Cloud SQL |249| Static site + API | Cloudflare Pages |250| WebSocket/real-time | Cloudflare Durable Objects |251| ML/AI pipelines | GCP Vertex AI |252| Browser automation | Cloudflare Browser Rendering |253254## Resources255256- **Cloudflare Docs:** https://developers.cloudflare.com257- **Docker Docs:** https://docs.docker.com258- **GCP Docs:** https://cloud.google.com/docs259- **Wrangler CLI:** https://developers.cloudflare.com/workers/wrangler/260- **gcloud CLI:** https://cloud.google.com/sdk/gcloud261262## Implementation Checklist263264### Cloudflare Workers265- [ ] Install Wrangler CLI266- [ ] Create Worker project267- [ ] Configure wrangler.toml (bindings, routes)268- [ ] Test locally with `wrangler dev`269- [ ] Deploy with `wrangler deploy`270271### Docker272- [ ] Write Dockerfile with multi-stage builds273- [ ] Create .dockerignore file274- [ ] Test build locally275- [ ] Push to registry276- [ ] Deploy to target platform277278### Google Cloud279- [ ] Install gcloud CLI280- [ ] Authenticate with service account281- [ ] Create project and enable APIs282- [ ] Configure IAM permissions283- [ ] Deploy and monitor resources