Cloud Run Quickstart: Build and Deploy a Web App in Your Language
Official Google Cloud quickstart — deploy a web app to Cloud Run from source with automatic Dockerfile generation. Go, Node, Python, Java, and more.
Deploy a Web App to Cloud Run Without Writing a Dockerfile
Cloud Run lets you deploy web apps and APIs as serverless containers: you bring code (or a container image), and Google handles scaling, HTTPS, and billing per request. You can deploy from source and let Cloud Run (and Cloud Build) generate a container image for you — no Dockerfile required for supported runtimes.
This post follows the official quickstart: Build and deploy a web app using the language of your choice (Cloud Run documentation). All links are to Google sources only.
Prerequisites (Official Checklist)
Before you start, ensure you have:
- Google Cloud CLI (
gcloud) installed — Install the Google Cloud CLI. - gcloud initialized — Run
gcloud initand sign in; set your project withgcloud config set project PROJECT_ID. - A Google Cloud project with billing enabled — Create a project.
- Required APIs enabled — At least Cloud Run and Cloud Build (and often Artifact Registry). The quickstart or Cloud Run quickstarts index will list the exact APIs.
One Critical Requirement: Listen on PORT
Cloud Run injects the port your container must listen on via the PORT environment variable. Your app must:
- Read
process.env.PORT(Node),os.environ['PORT'](Python), or the equivalent in your language. - Bind the HTTP server to that port (e.g.
0.0.0.0:PORT).
If you ignore PORT, the health check will fail and the deployment will not become ready. This is documented in Building containers for Cloud Run.
Deploy from Source (No Dockerfile)
For supported languages and frameworks, you can deploy from source and let Google generate the container:
- Navigate to your app directory (e.g. a Node.js, Python, or Go app with a standard layout).
- Deploy with
gcloud run deployand point to the source (e.g. current directory).- Example pattern (check the quickstart for your language):
gcloud run deploy SERVICE_NAME \
--source . \
--region REGION \
--allow-unauthenticated
--source .tells Cloud Run / Cloud Build to build from the current directory.- For private services, omit
--allow-unauthenticatedand use IAM to control who can invoke the service.
Cloud Build will build an image (using buildpacks or a generated Dockerfile when applicable), push it to Artifact Registry, and deploy it to Cloud Run. The first build may take a few minutes.
Other Ways to Deploy (Official Docs)
| Method | When to use | Doc link |
|---|---|---|
| Deploy from source | You have app code, want no Dockerfile | Build and deploy (other languages) |
| Deploy a container image | You already have an image in Artifact Registry or Docker Hub | Deploying container images to Cloud Run |
| Use Cloud Build in CI/CD | You want a pipeline (e.g. on git push) | Deploy a containerized application to Cloud Run using Cloud Build |
Quickstarts by Language and Scenario
The Cloud Run docs provide multiple quickstarts. A few examples (all on cloud.google.com):
- Go, Node.js, Python, Java, C#, C++, PHP, Ruby — language-specific “build and deploy” quickstarts.
- Prebuilt samples — Deploy a sample container without writing code.
- Cloud Run jobs — Run batch or one-off tasks.
- HTTP functions — Deploy from a function (e.g. Cloud Functions-style) to Cloud Run.
Use the Quickstarts index to pick the one that matches your stack.
After Deployment
- You get a URL like
https://SERVICE_NAME-XXXXX-REGION.run.app. - Logs: Cloud Run logs in Cloud Logging.
- Metrics: Cloud Run metrics in the console or via Monitoring.
- Custom domain / auth: See Cloud Run documentation for mapping custom domains and IAM.
References (Google sources only)
- Quickstart: Build and deploy a web app (other languages) — Cloud Run | Google Cloud Documentation
- Quickstarts index — Cloud Run — Google Cloud Documentation
- Deploying container images to Cloud Run — Google Cloud Documentation
- Building containers for Cloud Run — Google Cloud Documentation
- Deploy a containerized application to Cloud Run using Cloud Build — Cloud Build | Google Cloud Documentation