Integration of Docker+Jenkins+Github(Task2)
This task was bit difficult for me as this was my first time. I'm going to post here all the steps that I followed along with screenshots to complete the task. This type of integration eliminates most of the real life problems in the market.
The task was to-
- Create a container image that has Jenkins installed using Dockerfile. Dockerfile is one of the way other than commit command of creating an customised image.
- When we launch this image, it should automatically start Jenkins service in the container.
- Create a job chain of job1, job2 and job3 using build pipeline plugin in Jenkins. Build pipeline is a better way of to view the jobs as it shows all the details in a concise manner.
- Job1 : Pull the Github repo automatically when some developers push repo to Github.
- Job2 : Jenkins will start the respective container to deploy code.
- Job3 : Testing the app whether its working or not. We also done a task which sends thye email to developer with somen error messages if the app is not working using SMTP protocol.
Step1 - I created the image using Dockerfile.
After saving the file we will build and run the image.
We have used PAT for making accessing the jenkins from any other browser. After launching the o.s it gives us initial password for login, copy and paste the password on login page and later you can change the password.
Download all the suggested pipelines like Github, Email extension and Build pipeline which are necessary for this task. Further are the images of jobs that i have created.
I've used smtp protocol for sending the email notifications. In jenkins, go to Manage Jenkins > Configure systems.
After adding all the details click on test configuration and check whether it sends the email or not. Lastly this is the image of my dashboard where you can see the status of jobs.
Using build pipeline, we can view the jobs as shown in the image-
In future, we can modify this task by adding codes of any language and can straight post to employ with automation. There are many more tools like Kubernetes to use instead of dockers.