DevOps Skill
Comprehensive guide for deploying and managing cloud infrastructure across Cloudflare edge platform, Docker containerization, and Google Cloud Platform.
Summary
Goal: Deploy and manage cloud infrastructure across Cloudflare (edge), Docker (containers), and Google Cloud Platform (managed services).
| Step |
Action |
Key Notes |
| 1 |
Platform selection |
Cloudflare (edge/low-latency), Docker (microservices), GCP (managed) |
| 2 |
Configure infrastructure |
Workers, containers, or GCP services |
| 3 |
Set up CI/CD |
Automated build, test, deploy pipelines |
| 4 |
Deploy |
Multi-region, zero-downtime strategies |
| 5 |
Monitor |
Health checks, logging, cost optimization |
Key Principles:
- Choose platform based on latency, cost, and architecture requirements
- Cloudflare for edge-first with zero egress; Docker for portable microservices; GCP for managed scale
- Always automate deployments — no manual production changes
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
⚠️ MUST READ: 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
⚠️ MUST READ: 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
⚠️ MUST READ: 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
IMPORTANT Task Planning Notes
- Always plan and break many small todo tasks
- Always add a final review todo task to review the works done at the end to find any fix or enhancement needed
1---2name: devops-53description: [DevOps & Infra] 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## Summary1213**Goal:** Deploy and manage cloud infrastructure across Cloudflare (edge), Docker (containers), and Google Cloud Platform (managed services).1415| Step | Action | Key Notes |16|------|--------|-----------|17| 1 | Platform selection | Cloudflare (edge/low-latency), Docker (microservices), GCP (managed) |18| 2 | Configure infrastructure | Workers, containers, or GCP services |19| 3 | Set up CI/CD | Automated build, test, deploy pipelines |20| 4 | Deploy | Multi-region, zero-downtime strategies |21| 5 | Monitor | Health checks, logging, cost optimization |2223**Key Principles:**24- Choose platform based on latency, cost, and architecture requirements25- Cloudflare for edge-first with zero egress; Docker for portable microservices; GCP for managed scale26- Always automate deployments — no manual production changes2728## When to Use This Skill2930Use this skill when:31- Deploying serverless applications to Cloudflare Workers32- Containerizing applications with Docker33- Managing Google Cloud infrastructure with gcloud CLI34- Setting up CI/CD pipelines across platforms35- Optimizing cloud infrastructure costs36- Implementing multi-region deployments37- Building edge-first architectures38- Managing container orchestration with Kubernetes39- Configuring cloud storage solutions (R2, Cloud Storage)40- Automating infrastructure with scripts and IaC4142## Platform Selection Guide4344### When to Use Cloudflare4546**Best For:**47- Edge-first applications with global distribution48- Ultra-low latency requirements (<50ms)49- Static sites with serverless functions50- Zero egress cost scenarios (R2 storage)51- WebSocket/real-time applications (Durable Objects)52- AI/ML at the edge (Workers AI)5354**Key Products:**55- Workers (serverless functions)56- R2 (object storage, S3-compatible)57- D1 (SQLite database with global replication)58- KV (key-value store)59- Pages (static hosting + functions)60- Durable Objects (stateful compute)61- Browser Rendering (headless browser automation)6263**Cost Profile:** Pay-per-request, generous free tier, zero egress fees6465### When to Use Docker6667**Best For:**68- Local development consistency69- Microservices architectures70- Multi-language stack applications71- Traditional VPS/VM deployments72- Kubernetes orchestration73- CI/CD build environments74- Database containerization (dev/test)7576**Key Capabilities:**77- Application isolation and portability78- Multi-stage builds for optimization79- Docker Compose for multi-container apps80- Volume management for data persistence81- Network configuration and service discovery82- Cross-platform compatibility (amd64, arm64)8384**Cost Profile:** Infrastructure cost only (compute + storage)8586### When to Use Google Cloud8788**Best For:**89- Enterprise-scale applications90- Data analytics and ML pipelines (BigQuery, Vertex AI)91- Hybrid/multi-cloud deployments92- Kubernetes at scale (GKE)93- Managed databases (Cloud SQL, Firestore, Spanner)94- Complex IAM and compliance requirements9596**Key Services:**97- Compute Engine (VMs)98- GKE (managed Kubernetes)99- Cloud Run (containerized serverless)100- App Engine (PaaS)101- Cloud Storage (object storage)102- Cloud SQL (managed databases)103104**Cost Profile:** Varied pricing, sustained use discounts, committed use contracts105106## Quick Start107108### Cloudflare Workers109110```bash111# Install Wrangler CLI112npm install -g wrangler113114# Create and deploy Worker115wrangler init my-worker116cd my-worker117wrangler deploy118```119120**⚠️ MUST READ:** `references/cloudflare-workers-basics.md`121122### Docker Container123124```bash125# Create Dockerfile126cat > Dockerfile <<EOF127FROM node:20-alpine128WORKDIR /app129COPY package*.json ./130RUN npm ci --production131COPY . .132EXPOSE 3000133CMD ["node", "server.js"]134EOF135136# Build and run137docker build -t myapp .138docker run -p 3000:3000 myapp139```140141**⚠️ MUST READ:** `references/docker-basics.md`142143### Google Cloud Deployment144145```bash146# Install and authenticate147curl https://sdk.cloud.google.com | bash148gcloud init149gcloud auth login150151# Deploy to Cloud Run152gcloud run deploy my-service \153 --image gcr.io/project/image \154 --region us-central1155```156157**⚠️ MUST READ:** `references/gcloud-platform.md`158159## Reference Navigation160161### Cloudflare Platform162- `cloudflare-platform.md` - Edge computing overview, key components163- `cloudflare-workers-basics.md` - Getting started, handler types, basic patterns164- `cloudflare-workers-advanced.md` - Advanced patterns, performance, optimization165- `cloudflare-workers-apis.md` - Runtime APIs, bindings, integrations166- `cloudflare-r2-storage.md` - R2 object storage, S3 compatibility, best practices167- `cloudflare-d1-kv.md` - D1 SQLite database, KV store, use cases168- `browser-rendering.md` - Puppeteer/Playwright automation on Cloudflare169170### Docker Containerization171- `docker-basics.md` - Core concepts, Dockerfile, images, containers172- `docker-compose.md` - Multi-container apps, networking, volumes173174### Google Cloud Platform175- `gcloud-platform.md` - GCP overview, gcloud CLI, authentication176- `gcloud-services.md` - Compute Engine, GKE, Cloud Run, App Engine177178### Python Utilities179- `scripts/cloudflare-deploy.py` - Automate Cloudflare Worker deployments180- `scripts/docker-optimize.py` - Analyze and optimize Dockerfiles181182## Common Workflows183184### Edge + Container Hybrid185186```yaml187# Cloudflare Workers (API Gateway)188# -> Docker containers on Cloud Run (Backend Services)189# -> R2 (Object Storage)190191# Benefits:192# - Edge caching and routing193# - Containerized business logic194# - Global distribution195```196197### Multi-Stage Docker Build198199```dockerfile200# Build stage201FROM node:20-alpine AS build202WORKDIR /app203COPY package*.json ./204RUN npm ci205COPY . .206RUN npm run build207208# Production stage209FROM node:20-alpine210WORKDIR /app211COPY --from=build /app/dist ./dist212COPY --from=build /app/node_modules ./node_modules213USER node214CMD ["node", "dist/server.js"]215```216217### CI/CD Pipeline Pattern218219```yaml220# 1. Build: Docker multi-stage build221# 2. Test: Run tests in container222# 3. Push: Push to registry (GCR, Docker Hub)223# 4. Deploy: Deploy to Cloudflare Workers / Cloud Run224# 5. Verify: Health checks and smoke tests225```226227## Best Practices228229### Security230- Run containers as non-root user231- Use service account impersonation (GCP)232- Store secrets in environment variables, not code233- Scan images for vulnerabilities (Docker Scout)234- Use API tokens with minimal permissions235236### Performance237- Multi-stage Docker builds to reduce image size238- Edge caching with Cloudflare KV239- Use R2 for zero egress cost storage240- Implement health checks for containers241- Set appropriate timeouts and resource limits242243### Cost Optimization244- Use Cloudflare R2 instead of S3 for large egress245- Implement caching strategies (edge + KV)246- Right-size container resources247- Use sustained use discounts (GCP)248- Monitor usage with cloud provider dashboards249250### Development251- Use Docker Compose for local development252- Wrangler dev for local Worker testing253- Named gcloud configurations for multi-environment254- Version control infrastructure code255- Implement automated testing in CI/CD256257## Decision Matrix258259| Need | Choose |260| -------------------------------- | ---------------------------- |261| Sub-50ms latency globally | Cloudflare Workers |262| Large file storage (zero egress) | Cloudflare R2 |263| SQL database (global reads) | Cloudflare D1 |264| Containerized workloads | Docker + Cloud Run/GKE |265| Enterprise Kubernetes | GKE |266| Managed relational DB | Cloud SQL |267| Static site + API | Cloudflare Pages |268| WebSocket/real-time | Cloudflare Durable Objects |269| ML/AI pipelines | GCP Vertex AI |270| Browser automation | Cloudflare Browser Rendering |271272## Resources273274- **Cloudflare Docs:** https://developers.cloudflare.com275- **Docker Docs:** https://docs.docker.com276- **GCP Docs:** https://cloud.google.com/docs277- **Wrangler CLI:** https://developers.cloudflare.com/workers/wrangler/278- **gcloud CLI:** https://cloud.google.com/sdk/gcloud279280## Implementation Checklist281282### Cloudflare Workers283- [ ] Install Wrangler CLI284- [ ] Create Worker project285- [ ] Configure wrangler.toml (bindings, routes)286- [ ] Test locally with `wrangler dev`287- [ ] Deploy with `wrangler deploy`288289### Docker290- [ ] Write Dockerfile with multi-stage builds291- [ ] Create .dockerignore file292- [ ] Test build locally293- [ ] Push to registry294- [ ] Deploy to target platform295296### Google Cloud297- [ ] Install gcloud CLI298- [ ] Authenticate with service account299- [ ] Create project and enable APIs300- [ ] Configure IAM permissions301- [ ] Deploy and monitor resources302303## IMPORTANT Task Planning Notes304305- Always plan and break many small todo tasks306- Always add a final review todo task to review the works done at the end to find any fix or enhancement needed