DevOps Skill
Comprehensive guide for deploying and managing cloud infrastructure across Cloudflare edge platform, Docker containerization, and Google Cloud Platform.
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
Create and deploy Worker
wrangler init my-worker
cd my-worker
wrangler deploy
See: references/cloudflare-workers-basics.md
Docker Container
Build and run
docker build -t myapp .
docker run -p 3000:3000 myapp
See: references/docker-basics.md
Google Cloud Deployment
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
Benefits:
- Edge caching and routing
- Containerized business logic
- Global distribution
Multi-Stage Docker 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
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<triggers>12<trigger>Deploying serverless applications to Cloudflare Workers</trigger>13<trigger>Containerizing applications with Docker</trigger>14<trigger>Managing Google Cloud infrastructure with gcloud CLI</trigger>15<trigger>Setting up CI/CD pipelines across platforms</trigger>16<trigger>Optimizing cloud infrastructure costs</trigger>17<trigger>Implementing multi-region deployments</trigger>18<trigger>Building edge-first architectures</trigger>19<trigger>Managing container orchestration with Kubernetes</trigger>20<trigger>Configuring cloud storage solutions (R2, Cloud Storage)</trigger>21<trigger>Automating infrastructure with scripts and IaC</trigger>22</triggers>2324## 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<example type="usage">93<code language="bash">94# Install Wrangler CLI95npm install -g wrangler9697# Create and deploy Worker98wrangler init my-worker99cd my-worker100wrangler deploy101</code>102</example>103104See: `references/cloudflare-workers-basics.md`105106### Docker Container107108<example type="usage">109<code language="bash">110# Create Dockerfile111cat > Dockerfile <<EOF112FROM node:20-alpine113WORKDIR /app114COPY package*.json ./115RUN npm ci --production116COPY . .117EXPOSE 3000118CMD ["node", "server.js"]119EOF120121# Build and run122docker build -t myapp .123docker run -p 3000:3000 myapp124</code>125</example>126127See: `references/docker-basics.md`128129### Google Cloud Deployment130131<example type="usage">132<code language="bash">133# Install and authenticate134curl https://sdk.cloud.google.com | bash135gcloud init136gcloud auth login137138# Deploy to Cloud Run139gcloud run deploy my-service \140 --image gcr.io/project/image \141 --region us-central1142</code>143</example>144145See: `references/gcloud-platform.md`146147## Reference Navigation148149### Cloudflare Platform150- `cloudflare-platform.md` - Edge computing overview, key components151- `cloudflare-workers-basics.md` - Getting started, handler types, basic patterns152- `cloudflare-workers-advanced.md` - Advanced patterns, performance, optimization153- `cloudflare-workers-apis.md` - Runtime APIs, bindings, integrations154- `cloudflare-r2-storage.md` - R2 object storage, S3 compatibility, best practices155- `cloudflare-d1-kv.md` - D1 SQLite database, KV store, use cases156- `browser-rendering.md` - Puppeteer/Playwright automation on Cloudflare157158### Docker Containerization159- `docker-basics.md` - Core concepts, Dockerfile, images, containers160- `docker-compose.md` - Multi-container apps, networking, volumes161162### Google Cloud Platform163- `gcloud-platform.md` - GCP overview, gcloud CLI, authentication164- `gcloud-services.md` - Compute Engine, GKE, Cloud Run, App Engine165166### Python Utilities167- `scripts/cloudflare-deploy.py` - Automate Cloudflare Worker deployments168- `scripts/docker-optimize.py` - Analyze and optimize Dockerfiles169170## Common Workflows171172### Edge + Container Hybrid173174<example type="usage">175<code language="yaml">176# Cloudflare Workers (API Gateway)177# -> Docker containers on Cloud Run (Backend Services)178# -> R2 (Object Storage)179180# Benefits:181# - Edge caching and routing182# - Containerized business logic183# - Global distribution184</code>185</example>186187### Multi-Stage Docker Build188189<example type="usage">190<code language="dockerfile">191# Build stage192FROM node:20-alpine AS build193WORKDIR /app194COPY package*.json ./195RUN npm ci196COPY . .197RUN npm run build198199# Production stage200FROM node:20-alpine201WORKDIR /app202COPY --from=build /app/dist ./dist203COPY --from=build /app/node_modules ./node_modules204USER node205CMD ["node", "dist/server.js"]206</code>207</example>208209### CI/CD Pipeline Pattern210211<example type="usage">212<code language="yaml">213# 1. Build: Docker multi-stage build214# 2. Test: Run tests in container215# 3. Push: Push to registry (GCR, Docker Hub)216# 4. Deploy: Deploy to Cloudflare Workers / Cloud Run217# 5. Verify: Health checks and smoke tests218</code>219</example>220221## Best Practices222223### Security224- Run containers as non-root user225- Use service account impersonation (GCP)226- Store secrets in environment variables, not code227- Scan images for vulnerabilities (Docker Scout)228- Use API tokens with minimal permissions229230### Performance231- Multi-stage Docker builds to reduce image size232- Edge caching with Cloudflare KV233- Use R2 for zero egress cost storage234- Implement health checks for containers235- Set appropriate timeouts and resource limits236237### Cost Optimization238- Use Cloudflare R2 instead of S3 for large egress239- Implement caching strategies (edge + KV)240- Right-size container resources241- Use sustained use discounts (GCP)242- Monitor usage with cloud provider dashboards243244### Development245- Use Docker Compose for local development246- Wrangler dev for local Worker testing247- Named gcloud configurations for multi-environment248- Version control infrastructure code249- Implement automated testing in CI/CD250251<constraints>252<constraint severity="critical">Never commit secrets, API keys, or credentials to version control</constraint>253<constraint severity="critical">Always run containers as non-root user in production</constraint>254<constraint severity="high">Scan container images for vulnerabilities before deployment</constraint>255<constraint severity="high">Implement health checks for all containerized services</constraint>256<constraint severity="medium">Use multi-stage Docker builds to minimize image size</constraint>257<constraint severity="medium">Set resource limits (CPU, memory) for all containers</constraint>258</constraints>259260## Decision Matrix261262| Need | Choose |263|------|--------|264| Sub-50ms latency globally | Cloudflare Workers |265| Large file storage (zero egress) | Cloudflare R2 |266| SQL database (global reads) | Cloudflare D1 |267| Containerized workloads | Docker + Cloud Run/GKE |268| Enterprise Kubernetes | GKE |269| Managed relational DB | Cloud SQL |270| Static site + API | Cloudflare Pages |271| WebSocket/real-time | Cloudflare Durable Objects |272| ML/AI pipelines | GCP Vertex AI |273| Browser automation | Cloudflare Browser Rendering |274275## Resources276277- **Cloudflare Docs:** https://developers.cloudflare.com278- **Docker Docs:** https://docs.docker.com279- **GCP Docs:** https://cloud.google.com/docs280- **Wrangler CLI:** https://developers.cloudflare.com/workers/wrangler/281- **gcloud CLI:** https://cloud.google.com/sdk/gcloud282283## Implementation Checklist284285### Cloudflare Workers286- [ ] Install Wrangler CLI287- [ ] Create Worker project288- [ ] Configure wrangler.toml (bindings, routes)289- [ ] Test locally with `wrangler dev`290- [ ] Deploy with `wrangler deploy`291292### Docker293- [ ] Write Dockerfile with multi-stage builds294- [ ] Create .dockerignore file295- [ ] Test build locally296- [ ] Push to registry297- [ ] Deploy to target platform298299### Google Cloud300- [ ] Install gcloud CLI301- [ ] Authenticate with service account302- [ ] Create project and enable APIs303- [ ] Configure IAM permissions304- [ ] Deploy and monitor resources