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: MIT5version: 1.0.06metadata:7 source: https://skillmd.com/skills/hongbietcode/devops8---910# DevOps Skill1112Comprehensive guide for deploying and managing cloud infrastructure across Cloudflare edge platform, Docker containerization, and Google Cloud Platform.1314## When to Use This Skill1516Use this skill when:17- Deploying serverless applications to Cloudflare Workers18- Containerizing applications with Docker19- Managing Google Cloud infrastructure with gcloud CLI20- Setting up CI/CD pipelines across platforms21- Optimizing cloud infrastructure costs22- Implementing multi-region deployments23- Building edge-first architectures24- Managing container orchestration with Kubernetes25- Configuring cloud storage solutions (R2, Cloud Storage)26- Automating infrastructure with scripts and IaC2728## Platform Selection Guide2930### When to Use Cloudflare3132**Best For:**33- Edge-first applications with global distribution34- Ultra-low latency requirements (<50ms)35- Static sites with serverless functions36- Zero egress cost scenarios (R2 storage)37- WebSocket/real-time applications (Durable Objects)38- AI/ML at the edge (Workers AI)3940**Key Products:**41- Workers (serverless functions)42- R2 (object storage, S3-compatible)43- D1 (SQLite database with global replication)44- KV (key-value store)45- Pages (static hosting + functions)46- Durable Objects (stateful compute)47- Browser Rendering (headless browser automation)4849**Cost Profile:** Pay-per-request, generous free tier, zero egress fees5051### When to Use Docker5253**Best For:**54- Local development consistency55- Microservices architectures56- Multi-language stack applications57- Traditional VPS/VM deployments58- Kubernetes orchestration59- CI/CD build environments60- Database containerization (dev/test)6162**Key Capabilities:**63- Application isolation and portability64- Multi-stage builds for optimization65- Docker Compose for multi-container apps66- Volume management for data persistence67- Network configuration and service discovery68- Cross-platform compatibility (amd64, arm64)6970**Cost Profile:** Infrastructure cost only (compute + storage)7172### When to Use Google Cloud7374**Best For:**75- Enterprise-scale applications76- Data analytics and ML pipelines (BigQuery, Vertex AI)77- Hybrid/multi-cloud deployments78- Kubernetes at scale (GKE)79- Managed databases (Cloud SQL, Firestore, Spanner)80- Complex IAM and compliance requirements8182**Key Services:**83- Compute Engine (VMs)84- GKE (managed Kubernetes)85- Cloud Run (containerized serverless)86- App Engine (PaaS)87- Cloud Storage (object storage)88- Cloud SQL (managed databases)8990**Cost Profile:** Varied pricing, sustained use discounts, committed use contracts9192## Quick Start9394### Cloudflare Workers9596```bash97# Install Wrangler CLI98npm install -g wrangler99100# Create and deploy Worker101wrangler init my-worker102cd my-worker103wrangler deploy104```105106See: `references/cloudflare-workers-basics.md`107108### Docker Container109110```bash111# Create Dockerfile112cat > Dockerfile <<EOF113FROM node:20-alpine114WORKDIR /app115COPY package*.json ./116RUN npm ci --production117COPY . .118EXPOSE 3000119CMD ["node", "server.js"]120EOF121122# Build and run123docker build -t myapp .124docker run -p 3000:3000 myapp125```126127See: `references/docker-basics.md`128129### Google Cloud Deployment130131```bash132# Install and authenticate133curl https://sdk.cloud.google.com | bash134gcloud init135gcloud auth login136137# Deploy to Cloud Run138gcloud run deploy my-service \139 --image gcr.io/project/image \140 --region us-central1141```142143See: `references/gcloud-platform.md`144145## Reference Navigation146147### Cloudflare Platform148- `cloudflare-platform.md` - Edge computing overview, key components149- `cloudflare-workers-basics.md` - Getting started, handler types, basic patterns150- `cloudflare-workers-advanced.md` - Advanced patterns, performance, optimization151- `cloudflare-workers-apis.md` - Runtime APIs, bindings, integrations152- `cloudflare-r2-storage.md` - R2 object storage, S3 compatibility, best practices153- `cloudflare-d1-kv.md` - D1 SQLite database, KV store, use cases154- `browser-rendering.md` - Puppeteer/Playwright automation on Cloudflare155156### Docker Containerization157- `docker-basics.md` - Core concepts, Dockerfile, images, containers158- `docker-compose.md` - Multi-container apps, networking, volumes159160### Google Cloud Platform161- `gcloud-platform.md` - GCP overview, gcloud CLI, authentication162- `gcloud-services.md` - Compute Engine, GKE, Cloud Run, App Engine163164### Python Utilities165- `scripts/cloudflare-deploy.py` - Automate Cloudflare Worker deployments166- `scripts/docker-optimize.py` - Analyze and optimize Dockerfiles167168## Common Workflows169170### Edge + Container Hybrid171172```yaml173# Cloudflare Workers (API Gateway)174# -> Docker containers on Cloud Run (Backend Services)175# -> R2 (Object Storage)176177# Benefits:178# - Edge caching and routing179# - Containerized business logic180# - Global distribution181```182183### Multi-Stage Docker Build184185```dockerfile186# Build stage187FROM node:20-alpine AS build188WORKDIR /app189COPY package*.json ./190RUN npm ci191COPY . .192RUN npm run build193194# Production stage195FROM node:20-alpine196WORKDIR /app197COPY --from=build /app/dist ./dist198COPY --from=build /app/node_modules ./node_modules199USER node200CMD ["node", "dist/server.js"]201```202203### CI/CD Pipeline Pattern204205```yaml206# 1. Build: Docker multi-stage build207# 2. Test: Run tests in container208# 3. Push: Push to registry (GCR, Docker Hub)209# 4. Deploy: Deploy to Cloudflare Workers / Cloud Run210# 5. Verify: Health checks and smoke tests211```212213## Best Practices214215### Security216- Run containers as non-root user217- Use service account impersonation (GCP)218- Store secrets in environment variables, not code219- Scan images for vulnerabilities (Docker Scout)220- Use API tokens with minimal permissions221222### Performance223- Multi-stage Docker builds to reduce image size224- Edge caching with Cloudflare KV225- Use R2 for zero egress cost storage226- Implement health checks for containers227- Set appropriate timeouts and resource limits228229### Cost Optimization230- Use Cloudflare R2 instead of S3 for large egress231- Implement caching strategies (edge + KV)232- Right-size container resources233- Use sustained use discounts (GCP)234- Monitor usage with cloud provider dashboards235236### Development237- Use Docker Compose for local development238- Wrangler dev for local Worker testing239- Named gcloud configurations for multi-environment240- Version control infrastructure code241- Implement automated testing in CI/CD242243## Decision Matrix244245| Need | Choose |246|------|--------|247| Sub-50ms latency globally | Cloudflare Workers |248| Large file storage (zero egress) | Cloudflare R2 |249| SQL database (global reads) | Cloudflare D1 |250| Containerized workloads | Docker + Cloud Run/GKE |251| Enterprise Kubernetes | GKE |252| Managed relational DB | Cloud SQL |253| Static site + API | Cloudflare Pages |254| WebSocket/real-time | Cloudflare Durable Objects |255| ML/AI pipelines | GCP Vertex AI |256| Browser automation | Cloudflare Browser Rendering |257258## Resources259260- **Cloudflare Docs:** https://developers.cloudflare.com261- **Docker Docs:** https://docs.docker.com262- **GCP Docs:** https://cloud.google.com/docs263- **Wrangler CLI:** https://developers.cloudflare.com/workers/wrangler/264- **gcloud CLI:** https://cloud.google.com/sdk/gcloud265266## Implementation Checklist267268### Cloudflare Workers269- [ ] Install Wrangler CLI270- [ ] Create Worker project271- [ ] Configure wrangler.toml (bindings, routes)272- [ ] Test locally with `wrangler dev`273- [ ] Deploy with `wrangler deploy`274275### Docker276- [ ] Write Dockerfile with multi-stage builds277- [ ] Create .dockerignore file278- [ ] Test build locally279- [ ] Push to registry280- [ ] Deploy to target platform281282### Google Cloud283- [ ] Install gcloud CLI284- [ ] Authenticate with service account285- [ ] Create project and enable APIs286- [ ] Configure IAM permissions287- [ ] Deploy and monitor resources