Task 2

Keshav Sharma
3 min readJul 22, 2020

This is my second task in an online internship under the mentorship of Vimal dagga sir. This task is related to MLOps.After reading the blog you can understand how to write a docker file and how to do the job chaining in Jenkins.

Step 1: Create a container image that has Jenkins installed in the docker file.

FROM tells the docker that you want to build the new image.

RUN tells the command to be executed while building a docker file.

CMD lets you define a default command to run when your container starts.

To build this docker file:-

docker build -t -I Jenkins: latest /location

Now we will run our container image containing Jenkins.

docker run -it privileged -p 8888:8080 Jenkins:latest /root/task2

So then run Jenkins on the browser.

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. We will curl the Web server and then get the status code. If 200 then its working fine so we have done exit 1 so that Jenkins's job will terminate.

JOB4: If the above job succeeds i.e the app is not working this particular job will be triggered. In this job, we will send the email using the email plugin with all the configuration done.

JOB4: If the app stops, then this job will automatically create a new container having the same app. This job is triggered at every minute.

NOW ALL JOBS ARE COMPLETED IT AUTOMATICALLY LAUNCH PHP CODE.

I am giving you GitHub code where you can refer.

https://github.com/keshav340/tak2

--

--