Context
In 2026 I led the move of the learner web app's delivery onto Google Kubernetes Engine, with Cloud Build, Cloud Deploy and preview environments. I was the lead and the primary engineer.
The problem
The learner web app ran on a managed instance group under PM2. It had no preview environments and no promotion pipeline. Docker builds were slow and ran out of memory.
What I did
I built a Dockerized Next.js image, with per-environment Cloud Build and Cloud Deploy and approval gates.
I set up preview environments routed by a cookie or a request header.
I added health checks, autoscaling, Terraform for bucket and node-pool settings, and per-version asset prefixes with lifecycle cleanup.
I cut build size with a registry cache, BuildKit cache mounts and turbo prune. Docker dependencies fell from about 20 GB to about 2 GB.
I probed about 25 legacy paths to keep routing parity on every school domain.
Key decision
I built the new path in parallel with the old one, instead of cutting over at once. Every school domain keeps working while the new platform is proven.
The cost is running two paths for a while. Builds also moved to a larger machine type after 9 out-of-memory builds.
Result
Docker dependencies went from about 20 GB to about 2 GB. Previews and promotion pipelines now exist for the web app.
Status is honest: the new path runs alongside the legacy one, and the production front door has not fully cut over.
What I learned
I would shrink the build context first next time, before tuning machines. Smaller inputs fixed what bigger machines only hid.
Stack
- GKE
- Cloud Build
- Cloud Deploy
- Terraform
- Docker BuildKit
- Next.js
