TypeScriptActiveMIT

Next.js Cloud Run Starter

Production-ready Next.js 16 + Docker + Cloud Run template

A batteries-included starter template for deploying Next.js 16 applications to Google Cloud Run with Docker multi-stage builds and GitHub Actions CI/CD.

Next.jsDockerCloud RunGitHub ActionsTailwindCI/CD

What's Included

Next.js 16 with App Router and Turbopack·TailwindCSS 3 with typography plugin·Docker multi-stage build (deps → builder → runner)·GitHub Actions CI/CD with Workload Identity Federation·Cloud Run deployment to asia-south1·Security headers (CSP, X-Frame-Options, HSTS)·TypeScript 5 strict mode·ESLint 9 configuration

Quick Start

Clone the repository, install dependencies, and run the development server.

# Clone
git clone https://github.com/svbtechlabs/nextjs-cloudrun-starter
cd nextjs-cloudrun-starter

# Install
npm install

# Develop
npm run dev

Deploy to Cloud Run

Set the three required GitHub Actions secrets and push to main — the pipeline handles the rest.

# Required GitHub Secrets
GCP_PROJECT_ID           = your-gcp-project
GCP_WORKLOAD_IDENTITY_PROVIDER = projects/.../providers/github
GCP_SERVICE_ACCOUNT      = deploy-sa@your-project.iam.gserviceaccount.com

# Push to deploy
git push origin main

Docker Build

The Dockerfile uses a 3-stage build to keep the final image minimal. The runner stage runs as a non-root user for security.

# Build locally
docker build -t svbtechlabs-app .

# Run locally
docker run -p 3000:3000 svbtechlabs-app

Have a Contribution?

Issues, PRs, and feature ideas are always welcome.

Open an Issue on GitHub ↗