Getting Started with Google Container Builder

November 19, 2017

Introduction


In this series of posts we will learn how to store our application in GCP and configure a CI/CD pipeline within Google Cloud Platform using Google Container Builder.

So let’s review what Google Container Builder is, let’s see what we are going to do and let’s start!

 

Google Container Builder


Container Builder is a tool that uses Docker to execute builds and optionally, to create Docker containers. At first sight it seems to be a tool to create containers but it’s rater a tool that uses containers to perform builds.

To define the build process, Google Container Builder uses build requests. A build request configuration file is a YAML or JSON document which describes the build process.

Container Builder offers several supported build steps that you can use and also allows you to create your own custom build steps.

Let’s see the example below:

Image

1- The npm builder is used to run “npm install”
2- The ubuntu builder is used to run “bash ./myscript.bash”
3- The docker builder is used to run “docker build -t gcr.io/nodejs-demo .”
4- The created container is pushed to the container registry

Note that Google Container Builder support “substitutions” (like $PROJECT_ID in the example above). They are useful for setting variables whose value isn’t known until runtime (built-in substitutions), or for re-using an existing build request with different variable values.

For more information about Google Container Builder read the documentation

 

The Tutorial


In this tutorial we will build and deploy our Nodejs application using Google Container Builder.

 

The Application


You can find the application used in this example in GitHub

The application show a basic “Hello World” message and have a basic function to determine if a number is prime or not.

Image

Image

The folder “spec” contains the application tests which are run using the jasmine-node module.

Image

The application Dockerfile is very simple, use node as a base image, copy the application files, download the application dependencies and run the application in the port 3000.

Image

 

The Workflow


This series of post will guide you step by step to implement the pipeline below:

Image

1) Mirror GitHub with Google Source Repositories
2) Configure basic CI to create Docker Images and store them in Google Container Registry
3) Configure GKE to deploy the application
4) Configure CD to Kubernetes
5) Create custom build step to run tests
6) Add build notifications using cloud functions

 
 

Let’s Start!

Continue with: Getting Started with Google Container Builder – Part 1

 

Add comment
facebook linkedin twitter email

Leave a Reply