Looking for Senior AWS Serverless Architects & Engineers?
Let's TalkIn 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.
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.