Google Cloud Build is a powerful automation tool that can help you build and deploy containers on Google Cloud Platform. You can use it to build, test, and deploy applications using a variety of languages. To use Google Cloud Build, you first need to create a project. You can create a new project or use an existing one. To create a new project, you first need to choose the language you want to use. You can choose any of the languages that are available in Google Cloud Platform: Python, Java, C++, Node.js, and Ruby on Rails. Once you have chosen the language, you next need to set up your environment. You can do this by choosing the appropriate options in the Project Settings screen. The options include settings for your computer and for your development environment: hostname (the name of your computer), user name (the name of your user account), password (if needed), and compiler (the compiler used to produce code). Next, you need to create an application. To do this, you first need to create a file called application_configs in your project’s root directory. This file contains information about your application: its name, its version number, and its dependencies. The application_configs file also contains information about how Google Cloud Build will build and deploy your application: it will use the appropriate tools for building and deploying applications on Google Cloud Platform, including GCP Console and GCP Web App Builder. You then need to add an entry into your application_configs file that tells Google Cloud Build how to build and deploy your application: this entry will be called build_configuration . In addition to telling Google Cloud Build how to build and deploy your application, this entry also needs to tell Google Cloud Build how to find and load the appropriate libraries for building and deploying your application: this entry will be called library_configuration . Finally, this entry needs to tell Google Cloud Build how long it


Continuous Deployment and Integration is the process of automatically running tests and builds whenever source changes are pushed. You can set up Google Cloud Platform (GCP) to run automated Docker builds whenever you make updates to your container, and deploy to Cloud Run or Google Kubernetes Engine (GKE).

Overall, the configuration for this is fairly easy—Dockerfiles already handle most of the build configuration, so all that’s required from you is linking a few services together, and configuring Cloud Build to deploy updates to Cloud Run or GKE.

Create a Cloud Source Repository

Cloud Build pulls code from Cloud Source, Google’s own managed Git solution. You won’t have to transition from your current provider though, as you can simply link your GitHub or Bitbucket account, or just set it up as a separate release remote.

Head over to the Cloud Source console, and create a new repo. Give it a name, and sign in with your account to select a repository.

If you’re adding it as a separate remote, you can add the repo with the given git remote add command, which will make it available under the remote name “google.” To push to this branch, all you have to do is fully qualify the remote and branch name when running git push, replacing the default origin with google:

Setting Up Cloud Build

Head over to the Cloud Build Console, and set up a new build trigger:

This trigger will run in response to events in the source repository. Give it a name, and select whether you want to build in response to commits to a specific branch, or when new tags are pushed, or when pull requests are made to GitHub.

Below that, select “Dockerfile” as the build configuration, rather than Google’s own YAML config. This is the benefit of working with containers; you’ve already handled the build process in the Docker config, so you can simply select it here.

If your Dockerfile is named “Dockerfile” and placed at the root of the repository, you can leave the first two fields blank. For the image name, it will be pushed to GCR, Google’s own container registry.

Once created, you can click “Run Trigger” to manually start the build. Because Cloud Build just uses your Dockerfile, as long as it builds locally, you shouldn’t have any issues with the build.

If you head over to the GCR console, you should see the newly built image.

Configuring Automatic Deployments to Cloud Run

You can manually update your deployments, but if you want do automatic updates, you’ll need a bit more configuration.

Instead of choosing just the Dockerfile, you can choose to use a traditional YAML file, which will allow you to run some commands after the build process. In this case, running gcloud run deploy and passing it a ref to the newly created image in GCR.

You’ll also need to give Cloud Build permission to access Cloud Run from the service account settings.