Serverless Prisma 2 with GCP Cloud Run
summary
Step-by-step recipe for running Prisma 2 in production: package a GraphQL Nexus API with a multistage Docker build that caches package.json, installs production deps before dev deps and nohoists common packages, shrinking images from ~1.2 GB to 200–300 MB. Deploy the image to Cloud Run + Cloud SQL, create a service account with secret and Cloud SQL permissions, inject secrets at startup into a .env, run migrations in CI using the same container, and expect ~6s cold starts and a recommended instance concurrency of ~5 (DB limits ≈33).
AI-written summary · about
chapters (24)
- 0:00Introduction
- 1:15CLI
- 1:48Deployment
- 2:37Containers
- 3:28Dockerfile
- 5:34Multistage build
- 9:40Source code
- 11:08Drop privileges
- 11:47Why Cloud Run
- 12:56Database
- 14:36Postgres Database
- 15:15GCP Admin API
- 15:55New Database
- 16:08Migration
- 17:23Secrets
- 18:30Secret Manager
- 18:53Custom Script
- 19:36API Package
- 20:05Create Service Account
- 20:44Create Service in GCP
- 22:50Drawbacks
- 24:29Code
- 24:59Conclusion
- 25:22QA
