CI/CD: Google Cloud Build — Create/Store Docker Images via GitHub Trigger

Serverless Guru
Jan 5, 2019 · 4 min read

In this article, we are going to dive into the world of CI/CD pipelines. There are a lot of different options for incorporating a CI/CD into your development workflow. This article will focus on leveraging Google Cloud Build to handle the heavy lifting around creating and storing docker images.

If you’re interested in running custom scripts with Google Cloud Build and leveraging more powerful functionality, check out Google Cloud Build — Custom Scripts.

Prerequisites:

  • Github Account
  • Github Repository with Dockerfile
  • GCP Account

If you don’t have a Dockerfile already then check out our repository. You can fork the repository or just copy the files to follow along with this tutorial.

https://github.com/serverlessguru/docker

Navigate to Google Cloud Build:

Create Trigger:

Choose GitHub:

Select Repository:

Confirm Trigger:

Trigger your build via git:

Inside your locally cloned version of your application. Go ahead and make a small change then push it up to GitHub. This will kick off the Google Cloud Build trigger you’ve just created.

Check build history:

When the build kicks off you will be able to watch the build happen from the Google Cloud Build History tab.

Navigate to container registry:

Container Registry is google drive for container images. Amazon has their own version called, ECR. They both just help store your container images so they can easily be accessible by the supporting cloud provider services. On GCP this would be GKE (Google Kubernetes Engine).

Check out your uploaded container image:

The stored image should reflect your fully built application docker image which was created from your Dockerfile. The hard part is usually getting your container images on the cloud. Google Cloud Build makes this really simple.

Done 🎉. Powerful and easy. We didn’t have to set up a build server, manage any credentials, or any other headaches with other CI/CD pipelines. This was literally dead simple.

Now we have a way for our developers to make changes to the Dockerfile and then push it up to Google Container Registry. All through their normal git workflow!

If you’re interested in the other half where we actually deploy the docker container via GKE (Google Kubernetes Engine), stay tuned.

Additional Content:

What does Serverless Guru do?

Serverless Guru helps companies build scalable and cost-effective applications on the cloud. We help train companies on how to leverage IAC, serverless, and cloud-native services. We help migrate existing applications to the cloud and optimize existing applications on the cloud to be more cost-effective. We are a Serverless development partner and an AWS Consulting partner.

What did we miss?

When you leave your answer make sure to either comment below or tweet your answer to @serverlessgurux on Twitter.

https://www.serverlessguru.com

Ryan Jones

Founder — Serverless Guru

LinkedIn — @ryanjonesirl

Twitter — @ryanjonesirl

Thanks for reading 😃

If you would like to learn more about Serverless Guru, please follow us on Medium, Twitter, Instagram, Facebook, or LinkedIn!

Serverless Guru

Serverless Guru can help you migrate to serverless, build serverless applications, and train your team on serverless best practices. We are a Serverless Development partner and an AWS Consulting partner.

Serverless Guru

Written by

We can help you migrate to serverless, build serverless applications, and train your team on serverless best practices. https://www.serverlessguru.com

Serverless Guru

Serverless Guru can help you migrate to serverless, build serverless applications, and train your team on serverless best practices. We are a Serverless Development partner and an AWS Consulting partner.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade