Continuous Integration with Docker deployments – Part 2

How do you bind together tools like Jenkins, Junit, Maven, GitHub and S3 – along with Docker and Dockerfiles – to make the continuous integration process actually work?

In an earlier post on continuous integration using Docker, I wrote about the ingredients you’ll need for effective Docker/Jenkins deployments. Now I’ll discuss how the continuous integration process actually works.

Continuous Integration - DockerContinuous integration: the deployment process

The process starts when a developer checks out code from GitHub and adds a new feature. After launching a successful build on local dev systems, he (or she) will run a feature and performance test using Junit.
Once Junit is happy with the results, the developer pushes the new code back up to GitHub. Post-Hook (configured on GitHub) connects to the Jenkin server. Each check-in is then verified by an automated build, allowing teams to detect problems early. By integrating regularly, you can detect errors quickly, and locate them more easily.
Using the Jenkins GitHub Plugin, you can automatically trigger build jobs when pushes are made to GitHub.
The Jenkins server uses Maven to build its Java projects. Using Maven only requires that you create a pom.xml file and place your source code in the default directory. Maven will automatically take care of the rest:
Jenkin’s S3 plugin will copy build artifacts to an S3 bucket. The Jenkins Remote SSH plugin will log in to our Ec2 instance which Docker’s daemon installed and execute a Shell Script
This Shell Script contains Dockerfiles – Docker can build servers automatically by reading the instructions from a Dockerfile  (a Dockerfile is a text document that contains all the commands you would normally execute manually in order to build a server image).
The Dockerfile updates the OS, installs Tomcat and Java, pulls the code from S3, deploys to our web apps directory, and, finally, restarts Tomcat
Once QA approves the build, the Dev-Ops team uses chef-cookbook to deploy the code on to production Ec2 servers

Why introduce Docker into the continuous integration workflow

  • In Developer environments, we want remain as close as possible to production. We also want the development environment to be as fast as possible for interactive use.
  • Running multiple applications on the developer machine can slow it down. With Docker, you can easily launch a fresh server for every build.
  • Maintain one dedicated Docker container for for each application.
  • Before VMs, bringing up a new hardware resource took days. Virtualization brought this down to minutes. Docker, by creating just a container for the process and not booting up an OS, brings it down to seconds.
  • Ops benefits: only one standardized Dev environment to support.
  • Management benefits: faster time to market; happier engineers.
  • Developer benefits: detect problems early. Regular integration lets you detect and locate errors quickly.

Written by

My professional IT career began nine years back when I was just out of my college. I worked with a great team as an infrastructure management engineer, managing hundreds of enterprise application servers. I found my passion when I got the opportunity to work with Cloud technologies: I'm addicted to AWS Cloud Services, DevOps engineering, and all the cloud tools and technologies that make engineers' lives easier. Currently, I am working as a Solution Architect in SixNines IT. We are an experienced team of engineers that have helped hundreds of customers move to the cloud responsibly. I have achieved 5 AWS certifications, happily helping fellow engineers across the globe through my blogs and answering questions in various forums.

Related Posts

— March 9, 2018

New on Cloud Academy, March ’18: Machine Learning on AWS and Azure, Docker in Depth, and more

Introduction to Machine Learning on AWSThis is your quick-start guide for building and deploying with Amazon Machine Learning. By the end of this learning path, you will be able to apply supervised and unsupervised learning, ML algorithms, deep learning, and deep neural networks on AW...

Read more
  • Cloud Migration
  • Docker
  • Machine Learning & AI
  • Security
— January 18, 2018

New on Cloud Academy, January ’18: Security, Machine Learning, Containers, and more

LEARNING PATHSIntroduction to KubernetesKubernetes allows you to deploy and manage containers at scale. Created by Google, and now supported by Azure, AWS, and Docker, Kubernetes is the container orchestration platform of choice for many deployments. For teams deploying containeri...

Read more
  • Amazon Machine Learning
  • Docker
  • Security
— November 16, 2017

8 Hands-on Labs to Master Docker in the Enterprise

Docker containers are known for bringing a level of ease and portability to the process of developing and deploying applications. Where developers have embraced them for development and testing, enterprise DevOps professionals consider container technologies like Docker to be a strategi...

Read more
  • Docker
— September 19, 2017

New on Cloud Academy, September '17. Big Data, Security, and Containers

Explore the newest Learning Paths, Courses, and Hands-on Labs on Cloud Academy in September.Learning Paths and CoursesCertified Big Data Specialty on AWS Solving problems and identifying opportunities starts with data. The ability to collect, store, retrieve, and analyze data meanin...

Read more
  • AWS
  • Docker
  • Google Cloud
— September 8, 2017

Mesosphere to Incorporate Kubernetes into DC/OS

The announcement that Mesosphere is going to incorporate Kubernetes into DC/OS has generated a fair amount of buzz in the industry, with the consensus landing largely on the side that this is a sign that Mesosphere is ceding to Google’s open source software. I have a different perspecti...

Read more
  • DevOps
  • Docker
  • Kubernetes
— March 30, 2017

What is HashiCorp Vault? How to Secure Secrets Inside Microservices

Whether you are a developer or a system administrator, you will have to manage the issue of sharing "secrets" or secure information. In this context, a secret is any sensitive information that should be protected. For example, if lost or stolen,  your passwords, database credentials, or...

Read more
  • DevOps
  • Docker
  • HashiCorp Vault
— February 3, 2017

How to deploy Docker containers on AWS Elastic Beanstalk Applications

In this post, we are going to look at how to deploy two Docker containers on AWS Elastic Beanstalk Applications. Today, Docker containers are being used by many companies in sophisticated microservice infrastructures. From a developer point of view, one of the bigge...

Read more
  • Docker
— December 16, 2016

Docker Webinar Part 3: Production & Beyond

Last week, we wrapped up our three-part Docker webinar series. You can watch the Docker Webinar session on the webinars page and find the slides on Speakerdeck. Docker Webinar part one introduced Docker, container technologies, and how to get started in your development environment. It ...

Read more
  • AWS
  • Docker
— November 11, 2016

Docker deployment – Webinar Series Part 2: From Dev to Production

Docker deployment: I recently held Part 2 of a three-part webinar series on Docker. For those of you who could not attend, this post summarizes the main topics that we covered. It also includes some additional items based on the QA session. You can watch part 2  and read the detailed QA...

Read more
  • Cloud Computing
  • Docker
— November 1, 2016

Docker containers Webinar Part 1: how they work, from idea to Dev

The Docker containers Webinar: on October 19, I held Part 1 of a three-part webinar series on Docker. For those of you who could not attend, this post summarizes the webinar material. It also includes some additional items that I've added based on the QA session. Finally, I will highlig...

Read more
  • Cloud Computing
  • Docker
— October 25, 2016

Container technologies: more than just Docker

Container technologies: Docker has gained widespread industry adoption and success since its release in 2014. As more people push to Dockerize everything, it's important to realize that Docker is only the first wave of successful container technology. Here are just some of the reasons w...

Read more
  • Cloud Computing
  • Docker
— September 8, 2016

New Course: Introduction to Docker

Docker has become a mainstay in the DevOps world, and Cloud Academy has released a new course called Introduction to Docker in order to gently introduce you to this incredible technology.We're very excited to release this course because there is an enormous amount of demand for contain...

Read more
  • AWS
  • Docker