Integrating Github , Jenkins and Docker
Hello connections , I am back with another small project using some intresting technologies like Docker , Github and Jenkins
The description of the project is as follows :-
1. Create container image that’s has Jenkins installed using dockerfile
2. When we launch this image, it should automatically starts Jenkins service in the container.
3. Create a job chain of job1, job2, job3 and job4 using build pipeline plugin in Jenkins
4. Job1 : Pull the Github repo automatically when some developers push repo to Github.
5. Job2 : By looking at the code or program file, Jenkins should automatically start the respective language interpreter install image container to deploy code ( eg. If code is of PHP, then Jenkins should start the container that has PHP already installed ).
6. Job3 : Test your app if it is working or not.
7. Job4 : if app is not working , then send email to developer with error messages.
8. Create One extra job job5 for monitor : If container where app is running. fails due to any reson then this job should automatically start the container again.
Let's get start with creating a dockerfile with jenkins installed and enabled in it, httpd installed and enabled in it.
we created a new directory using "mkdir" command and name of directory is project
so, command is "mkdir project"
cd project/
using any text editor and start writing the Dockerfile
After writing the code in the Dockerfile, Now we create or build our own customized image using "docker build -t myos1:v1 . "
Here, myos1:v1 is my image name.
Now we built the job 1,which will pull the Github repo automatically when some developers push repo to Github.
this command will pull the code from github and copy to the directory.
We want if job 1 is successfull then it should trigger or start building job 2.
Now, we start building job 2 which is by looking at the code or program file, Jenkins should automatically start the respective language interpreter install image container to deploy code ( example If code is of PHP, then Jenkins should start the container that has PHP already installed ).
Job 3 :Test your app if it is working or not. if app is not working , then send email to developer with error messages.
job 5:Create One extra job job 5 for monitor : If container where app is running. fails due to any reason then this job should automatically start the container again.
That's it guys, We have completed the project.
I thank LinuxWorld Informatics Pvt. Ltd.
I would also like to give a hearty thank to Vimal Daga sir for giving such a great task that makes me grow and thing out of box.
I also thank all the Technical volunteers for their support.