My Minimal Cloud Run Setup
Why Cloud Run?
For my smaller projects, I don't want to manage a VM, Kubernetes cluster, or a bunch of infrastructure just to run an API.
I mostly want to build a Docker image, deploy it, give it a domain, and let it scale when needed.
That's where Cloud Run fits really well for me.
The Docker Image
For the blog, I use Docker to build and run the Nuxt application.
I use a multi-stage build so the final image only contains the production output generated by Nuxt.
FROM node:22-alpine AS builder
WORKDIR /app
RUN corepack enable
RUN apk add --no-cache \
python3 \
make \
g++
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm exec nuxt prepare
RUN pnpm build
FROM node:22-alpine
WORKDIR /app
COPY --from=builder /app/.output ./.output
ENV NODE_ENV=production
ENV HOST=0.0.0.0
CMD ["node", ".output/server/index.mjs"]
Building with Cloud Build
I use Google Cloud Build to build my Docker image and push it to Artifact Registry.
My cloudbuild.yaml is intentionally small:
options:
logging: CLOUD_LOGGING_ONLY
steps:
- name: 'gcr.io/cloud-builders/docker'
waitFor: ['-']
entrypoint: 'bash'
args:
- '-c'
- |
set -e
IMAGE="asia-docker.pkg.dev/${PROJECT_ID}/nuxt/nuxt-app"
docker build \
-t $${IMAGE}:${SHORT_SHA} \
-t $${IMAGE}:latest \
.
images:
- asia-docker.pkg.dev/${PROJECT_ID}/nuxt/nuxt-app:${SHORT_SHA}
- asia-docker.pkg.dev/${PROJECT_ID}/nuxt/nuxt-app:latest
Going Serverless
I use Cloud Build triggers together with Cloud Run to keep the blog serverless.
Instead of running the deployment process on my own machine, I manually trigger a Cloud Build whenever I want to deploy a new version.
The trigger runs my cloudbuild.yaml, which builds the Docker image and pushes it to Artifact Registry. Cloud Run then runs the container.
Manual Trigger
↓
Cloud Build
↓
Docker Build
↓
Artifact Registry
↓
Cloud Run
The important part is that I don't have to manage a server or virtual machine myself.
Cloud Run handles running the container and can scale it down when there is no traffic.
For a small personal blog, this gives me a simple serverless setup without having to manage traditional server infrastructure.
Building My Blog with Nuxt
My journey building a personal blog with Nuxt, from choosing the stack to figuring out how I wanted the site to work.
What It's Like Learning a Language at 30
Starting to learn Chinese at thirty—from forgetting vocabulary to actually chatting with friends—here are some of my reflections on the journey.