Integrating GitHub, Jenkins and Docker
This article discusses how the three great technologies - GitHub, Jenkins and Docker, can be clubbed together to automate the task of downloading, deploying and testing the code. The code will be downloaded from GitHub. Then, a docker container will be launched having the respective interpreter of code and testing will be initiated. All these tasks will be automated via Jenkins tool.
To begin with, some docker images are created using Docker file method.
1. Docker image containing Jenkins
2. Docker image containing Python interpreter
Now, the docker image having Jenkins is launched. (In the image below, the container launched has the name 'jenkins')
Now, the role of Jenkins' jobs come into play.
Job 1 : Pulling code from GitHub
This job pulls the code from GitHub whenever a developer pushes a code to the GitHub repository.
Job 2 : Identifying the code for launching image having respective language interpreter
This job will identify the language of code and launch the docker image having respective language interpreter in it.
A Python code will help in identifying the language of code. (DockerFile.py)
Job 3 & 4 : Checking if code is working or not
This job will test the code and if the code fails to execute, an email will be sent to the developer regarding the failure via Jenkins' plugin with the logs attached.
Hence, the trio has been integrated to solve yet another use case in the industry thus, making the process of code deployment and testing more efficient.