Integrating Github , Jenkins and Docker (running a container in docker)
This article contains how Jenkins makes the project automate for the developer from writing the code to deployment just by assigning the jobs.
Task :-
- Use the docker file to build the container with the customized image having Jenkins installed .
- Jenkins should automatically Start as soon as the image is successfully launched.
- Now we have assign the jobs to the Jenkins and create a chain of the jobs using pipeline plugins.
Now, we are going to create the file with name DOCKERFILE having the following commands:
Now we will use our VM and run the command :
Jenkins project performs a full test flow with the following JDK/JREs:
OpenJDK JDK / JRE 8 - 64 bits
OpenJDK JDK / JRE 11 - 64 bits
Using the cmd : docker image
To check the status that the image is active or not
Now , logging in Jenkins in browser
JOB 1:- Automatically pulling the repo from GitHub whenever the developer push the repo using ssh plugins.
> After successfully logging in to jenkins we have to install GitHub plugin .
> Then we have to provide the GitHub URL to fetch data.
JOB2:- By looking at the code or program file , jenkins should automatically start the respective language interpreter install image container to deploy code.
JOB3:- Testing the app if it is working or not .
JOB4:- Check if the app is not working , then send email to developer with error messages.We created a python file and if this site wont work or face any error ,it will run and developer will receive any email.
>import smtplib
>server = smtplib.SMTP_SSL(“smtp.gmail.com”,465)
>server.login = (mltask2@gmail.com,******)
>server.sendmail(“rohitkumawat1968@gmail.com”,
your site is not working)
>server.quit()
This is the full automation of the php server using GitHub, Jenkins, and Docker.
Thank u…!!