Problem Statement :
Create a container image that’s has Jenkins installed using Dockerfile.
When we launch this image, it should automatically start the Jenkins service in the container.
Create a job chain of job1, job2, job3 and job 4 using the build pipeline plugin in Jenkins.
Job1: Pull the GitHub repo automatically when some developers push the repo to GitHub.
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 ).
Job3: Test your app if it is working or not.
Job4: If the app is not working, then send an email to the developer with error messages.
Create One extra job job5 for monitor: If the container where the app is running. fails due to any reason then this job should automatically start the container again.
solution:
First I made a local git repository named devops2 having an html and a php file.
Then I created a docker image using Dockerfile such that whenever a container is launched through it , it automatically launch jenkins service in it.
This image is available for download at:
Now I created a mail.py file so as to enable mailing service to developer in case job fails due to any error.
image was successfully built:
Now using this image I made a container taskos.
Job1: Pull the GitHub repo automatically when some developers push the repo to GitHub.
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 ).
Job3: Test your app if it is working or not.
Job4: If the app is not working, then send an email to the developer with error messages.
Create One extra job job5 for monitor: If the container where the app is running. fails due to any reason then this job should automatically start the container again.