Deploy application to GCP with Cloud Run

Cloud Run is selected to serve my Rails website.

I build the site as a docker image, and push to Docker Hub private repository.

This post will show all steps to deploy the site to GCP Cloud Run.


1/ Setup GCP account, activate billing and Cloud Run service.

2/ Create an Artifact Repository 

So the URL will be as this: asia-southeast1-docker.pkg.dev/<ProjectName>/<RepositoryName>


3/ Build the project and push to Docker Hub (why: in case we can use difference cloud platform, Docker Hub is available also)

4/ Create a PAT token in Docker Hub8

5/ Activate Cloud Shell on GCP (this is free VM for all accounts)

6/ Login to Docker Hub with this command: docker login -u <UserName> -p <YourPAT>

7/ Pull the image from Docker Hub to local cloud shell VM

docker pull <DockerHubImage>

8/ Tag the image to a GCP artifact, like:

docker tag  <DockerHubImageasia-southeast1-docker.pkg.dev/<ProjectName>/<RepositoryName>/easyweb:240918

9/ Push the tag to GCP artifact registry

10/ Go to Cloud Run and deploy a new container

https://console.cloud.google.com/run

11/ Add custom domain, like https://easyweb.abizvn.com/

Back to posts