Google Cloud deployment. Cloud Run, App Engine, Firebase Hosting.
Deploy to Cloud Run, App Engine, Firebase.
Before deploying to GCP:
| Dimension | Spectrum |
|---|---|
| Compute | Cloud Run (containers) ←→ App Engine ←→ GKE |
| Hosting |
| Firebase (static) ←→ Cloud Run (dynamic) |
| Scaling | Scale to zero ←→ Min instances ←→ Always-on |
| Complexity | firebase deploy ←→ gcloud run deploy ←→ Terraform |
| Cost | Pay-per-request ←→ Reserved |
| If Context Is... | Then Consider... |
|---|---|
| Static site | Firebase Hosting |
| Next.js with SSR | Firebase App Hosting or Cloud Run |
| Docker container | Cloud Run |
| Need WebSockets | Cloud Run (not Vercel) |
| Backend API | Cloud Run |
| Google services heavy | GCP native (easier integration) |
| Platform | Best For | Setup Time | Cost |
|---|---|---|---|
| Cloud Run | Containers, APIs | 15 min | Pay per use |
| Firebase Hosting | Static sites, Next.js | 10 min | Free tier generous |
| App Engine | Traditional web apps | 20 min | Always-on pricing |
vs Vercel: Use Google for backend APIs, Google services integration. Use Vercel for Next.js (easier).
# Install CLI
gcloud components install cloud-run
# Deploy
gcloud run deploy my-app \
--source . \
--region us-central1 \
--allow-unauthenticated
Next.js 16.1.1 Dockerfile:
FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
CMD ["npm", "start"]
Cost: $0.00002400 per request (100K requests = $2.40)
npm install -g firebase-tools
firebase login
firebase init hosting
firebase deploy
Next.js config:
// firebase.json
{
"hosting": {
"public": "out",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
}
}
Cost: Free up to 10GB/month
| Use Case | Vercel | |
|---|---|---|
| Next.js app | ❌ | ✅ (easier) |
| Backend API | ✅ | ⚠️ (functions only) |
| Containers | ✅ | ❌ |
| Google services | ✅ | ❌ |
| WebSockets | ✅ | ❌ |
| Cost control | ✅ | ⚠️ (can get expensive) |
# Cloud Run
gcloud run services update my-app \
--set-env-vars="DATABASE_URL=xxx,API_KEY=yyy"
# Firebase
firebase functions:config:set stripe.key="xxx"
# Cloud Run
gcloud run domain-mappings create \
--service=my-app \
--domain=myapp.com
# Firebase
firebase hosting:channel:deploy production \
--only hosting
agents/deployment/SKILL.md - Vercel deploymentagents/database/SKILL.md - Connect to Cloud SQL