Agentic AI with Java: Live Cohort
Claude CodeDeploying the Application on Google Cloud

The Deployment Pipeline

The plan for taking the Content Tracker from your laptop to a public URL on Google Cloud Run, using Docker and Claude Code at every step.

The app is built and secured. The final step is to put it on the internet. You could do this by hand: configure a server, install Python, copy files, set up a process manager. It works, but it takes time and is easy to get wrong.

Instead, we use Claude Code to prepare the project and write the Dockerfile, and we deploy the resulting container to Google Cloud Run.

The steps matter more than the cloud

We use Google Cloud Run because it is simple for container-based apps and has a free tier. The same approach (single origin, Dockerfile, test locally, push an image, run it) works on AWS, Azure or any other platform. Focus on the logic, not on memorising gcloud commands.

The pipeline

Deployment pipeline: prepare, Dockerfile, local test, gcloud setup, Cloud Build, Cloud Run
StepWhat we doLesson
1. PrepareRemove hardcoded URLs and serve the frontend from FastAPI, so the whole app runs from one originPreparing the App for Deployment
2. DockerfileAsk Claude Code for a Dockerfile, with precise requirementsDockerizing and Testing the App Locally
3. Local testBuild the image and run it with Docker on your machineSame lesson
4. Google Cloud setupCreate a project, install the Google Cloud CLI, log inGoogle Cloud Project and SDK Setup
5. Build and storeCloud Build builds the image and stores it in Artifact RegistryArtifact Registry, Cloud Run and Testing
6. RunCloud Run runs the container and gives us an HTTPS URLSame lesson

Why a single origin?

Locally we run two servers: the frontend on one port and the FastAPI backend on another. We could deploy them as two separate services, but that means two deployments, two URLs and CORS configuration between them.

Our frontend is just HTML, CSS and JavaScript. FastAPI can serve those files itself. Then the entire app is one container on one URL.

From two origins to a single origin

Why Docker?

A container packages the app with its exact Python version, dependencies and start command. If it runs in Docker on your laptop, it runs the same way on Cloud Run. Without a container, every difference between your machine and the server becomes a debugging session. (For a full introduction, see the Docker docs on this site.)

Cloud Run in a nutshell

Cloud Run service, revisions and instances
ConceptMeaning
ServiceYour app on Cloud Run, with one stable HTTPS URL. Ours is telusko-app
RevisionAn immutable snapshot created by every deploy (image plus settings). You can send traffic back to an older revision to roll back
InstanceA running copy of your container. Cloud Run adds instances when traffic grows
Scale to zeroWith no requests, Cloud Run can stop all instances, so an idle app costs very little
Container contractYour container must listen on the port in the PORT environment variable (8080 by default)

What it costs

Cloud Run bills for the resources used while handling requests, and there is a monthly free tier. Cloud Build and Artifact Registry also have free allowances. For a small learning project the cost is usually zero or close to it, but always check the Cloud Run pricing page and set a budget alert.

What you need

  • Docker Desktop (or Docker Engine) installed and running
  • A Google account with access to the Google Cloud console. New accounts usually get free credits, but Cloud Run and Cloud Build may need billing enabled on the project
  • The Google Cloud CLI (gcloud), installed in a later lesson

Things can go wrong, and that is fine

Deployments often fail the first time: a missing permission, a wrong path, a typo in a flag. That is normal. Read the error, give it to Claude Code with the context, and fix one thing at a time.

Official references


Written By: Shramik Masti

How is this guide?

Last updated on