Home CloudHow to Deploy a Website with Google Cloud Run ?

How to Deploy a Website with Google Cloud Run ?

by Ardra Shaji
Banner illustration showing a web browser window sending data to a cloud and then to a laptop and a phone, with a globe in the background and the title 'Deploy a Website with Google Cloud Run'.

Modern applications need to be scalable, reliable, and easy to deploy. However, managing servers, configuring infrastructure, and handling traffic spikes can add significant complexity to the deployment process.

Google Cloud Run solves these challenges by providing a fully managed serverless platform for running containerized applications. Developers can deploy applications directly from container images without worrying about server management, operating system maintenance, or infrastructure scaling.

In this guide, you’ll learn how to deploy a website on Google Cloud Run, from setting up your environment to deploying updates with zero downtime.

What Is Google Cloud Run?

Google Cloud Run is a serverless compute platform that allows you to run containerized applications on demand. It automatically scales based on incoming traffic and only charges for resources used during request processing.

Benefits of Google Cloud Run

  • Fully managed serverless infrastructure
  • Automatic scaling up and down
  • Pay-per-use pricing
  • Zero-downtime deployments
  • Built-in HTTPS endpoints
  • Easy integration with Google Cloud services

These advantages make Cloud Run an excellent choice for hosting modern web applications and APIs.

Prerequisites

Before deploying your application, make sure you have:

  • A Google Cloud account
  • An active Google Cloud project
  • Billing enabled
  • Cloud Run API enabled
  • Access to Cloud Shell or the Google Cloud CLI

Once these requirements are met, you’re ready to begin.

Step 1: Set Up Your Google Cloud Environment

The first step is preparing your Google Cloud project for deployment.

Create or Select a Project

You can either create a new Google Cloud project or use an existing one.

After selecting your project, configure it using:

gcloud config set project PROJECT_ID

This command ensures all future actions are associated with the correct Google Cloud project.

Enable Required Services

Before deploying, make sure the following services are enabled:

  • Cloud Run API
  • Cloud Build API
  • Container Registry (or Artifact Registry)

These services are required for building and deploying container images.

Step 2: Configure Your Cloud Environment

Next, configure your default region and verify your settings.

gcloud config set compute/zone us-central1-f
gcloud config list

This step confirms that your deployment resources are configured correctly.

Why This Matters

Proper configuration helps avoid deployment issues caused by incorrect project or region settings.

Step 3: Clone the Sample Application

For this tutorial, you’ll use Google’s sample application from the official Cloud Run codelab.

git clone https://github.com/googlecodelabs/monolith-to-microservices.git

cd monolith-to-microservices

./setup.sh

This process:

  • Downloads the application source code
  • Installs dependencies
  • Prepares the environment for testing and deployment

Step 4: Test the Application Locally

Before deploying to Cloud Run, verify that your application works correctly.

Navigate to the application directory and start the application:

cd monolith

npm start

If successful, you should see:

Monolith listening on port 8080!

Use Cloud Shell Preview or your browser to access the application.

Why Local Testing Is Important

Testing locally helps identify issues before they reach production, reducing deployment failures and troubleshooting time.

Step 5: Build and Push the Container Image

Google Cloud Run requires applications to be packaged as containers.

Use Cloud Build to create and push the container image:

gcloud builds submit --tag gcr.io/$GOOGLE_CLOUD_PROJECT/monolith:1.0.0

This command automatically:

  • Builds the Docker image
  • Uploads it to Google Container Registry
  • Makes it available for deployment

Benefits of Cloud Build

Cloud Build eliminates the need to build containers locally and integrates seamlessly with Cloud Run.

Step 6: Deploy Your Website to Google Cloud Run

Now it’s time to deploy the application.

Run:

gcloud run deploy --image=gcr.io/$GOOGLE_CLOUD_PROJECT/monolith:1.0.0 --platform managed

During deployment:

  • Select your preferred region
  • Accept the default service name
  • Enable unauthenticated access if the application should be public

Cloud Run will automatically generate a secure public URL for your website.

Step 7: Verify the Deployment

After deployment, confirm that the service is running.

gcloud run services list

This command displays:

  • Service name
  • Deployment region
  • Public endpoint URL

Open the generated URL in your browser to verify the application is live.

Step 8: Understand Cloud Run Revisions and Scaling

One of Cloud Run’s most powerful features is automatic revision management.

Every deployment creates a new revision.

For example:

gcloud run deploy \
--image=gcr.io/$GOOGLE_CLOUD_PROJECT/monolith:1.0.0 \
--platform managed \
--concurrency 1

Understanding Concurrency

Cloud Run allows multiple requests per container instance.

  • Default concurrency: 80 requests
  • Lower concurrency: Better isolation but higher costs
  • Higher concurrency: Better efficiency and lower costs

Choosing the right concurrency setting helps optimize performance and resource usage.

Step 9: Deploy Application Updates with Zero Downtime

Cloud Run supports seamless application updates without service interruptions.

To deploy a new version:

gcloud run deploy \
--image=gcr.io/$GOOGLE_CLOUD_PROJECT/monolith:2.0.0 \
--platform managed

What Happens During Deployment?

Cloud Run automatically:

  1. Creates a new revision
  2. Deploys the updated version
  3. Redirects traffic to the new revision
  4. Preserves previous revisions for rollback

This ensures users experience zero downtime during updates.

Step 10: Manage Your Cloud Run Service

You can manage services through:

  • Google Cloud Console
  • Cloud Shell
  • Google Cloud CLI

To inspect service details:

gcloud run services describe monolith

This command helps you:

  • Review configurations
  • Analyze traffic routing
  • Troubleshoot deployment issues
  • Monitor service settings

Best Practices for Google Cloud Run Deployments

To maximize performance and reliability, follow these best practices:

-> Use Fully Managed Cloud Run

Managed Cloud Run removes infrastructure maintenance responsibilities and simplifies operations.

-> Test Before Deployment

Always validate application functionality locally before deploying.

-> Monitor Logs Regularly

Use Google Cloud Logging to identify runtime errors and performance issues.

-> Leverage Revisions

Cloud Run revisions provide:

  • Easy rollbacks
  • Safer feature testing
  • Simplified deployment management

-> Optimize Concurrency Settings

Balance application performance and operational costs by selecting an appropriate concurrency level.

Common Mistakes to Avoid

When deploying applications on Cloud Run, avoid these common issues:

– Forgetting to Enable Required APIs

Cloud Run and Cloud Build APIs must be enabled before deployment.

– Incorrect Access Configuration

Failing to allow unauthenticated access may prevent public users from reaching your application.

– Skipping Local Testing

Unverified code often leads to deployment failures.

– Misconfigured Container Ports

Cloud Run expects your application to listen on the correct port. Incorrect configurations can prevent successful deployment.

Conclusion

Google Cloud Run is one of the easiest ways to deploy and manage modern web applications in a serverless environment. By combining container-based deployment, automatic scaling, and zero-downtime updates, it allows developers to focus on building applications rather than managing infrastructure.

By following this step-by-step Google Cloud Run deployment guide, you can:

  • Deploy containerized applications quickly
  • Scale automatically based on demand
  • Minimize operational overhead
  • Release updates without downtime

For organizations looking for a fast, scalable, and cost-effective hosting solution, Google Cloud Run is an excellent platform for modern application deployment.

Need Help Managing Your Google Cloud Infrastructure?

SupportPRO helps businesses deploy, optimize, secure, and manage workloads on Google Cloud. Contact our team to simplify cloud operations and ensure maximum application performance.

Facing issues?

Our technical support
engineers can solve it.

Contact Us today!
guy server checkup

You may also like

Leave a Comment