Docker Jenkins Automation
Docker Jenkins Automation
Task Description –
- Create container image that’s has Linux and other basic configuration required to run Slave for Jenkins. (example here we require kubectl to be configured)
- When we launch the job it should automatically starts job on slave based on the label provided for dynamic approach.
- Create a job chain of job1 and job 2 using build pipeline plugin in Jenkins.
- JOB 1 – Pull the Github repo automatically when some devlopers push repo to github and perform the following operations as:
1.
Create the new image dynamically for
the application and copy the application code into that corresponding Docker
image.
2.
Push that image to the Docker hub (
Public Repository ) ( Github code contain the application code and Dockerfile
to create a new image.
- JOB 2 – Launch the application on the top of kubernetes cluster performing following operations.(Should be run on the dynamic slave of Jenkins configured with kubernetes kubectl command.)
1.
If launching first time then create a
deployment of the pod using the image created in the previous Job. Else if
deployment already exists then do rollout of the existing pod making zero
downtime for the user.
2.
If application created first time,
then expose the application. Else don’t expose it.
BUILDING THE PROJECT -
- Creating The Docker File - For creating the Docker Image you have to write following code for DockerFile.
- Then build the DockerFile and use it.
- After run the custom DockerFile go to Jenkins and Install the Docker Plugin there.
![]() |
- Jobs For Jenkins -
- JOB1 - Pull the Github repo automatically when some devlopers push repo to github and perform the following operations as:
1. Create the new image dynamically for the application and copy the application code into that corresponding Docker image.
2. Push that image to the Docker hub ( Public Repository ) ( Github code contain the application code and Dockerfile to create a new image.
- JOB 2 - Launch the application on the top of kubernetes cluster performing following operations.(Should be run on the dynamic slave of Jenkins configured with kubernetes kubectl command.)
1. If launching first time then create a deployment of the pod using the image created in the previous Job. Else if deployment already exists then do rollout of the existing pod making zero downtime for the user.
2. If application created first time, then expose the application. Else don’t expose it.
1. If launching first time then create a deployment of the pod using the image created in the previous Job. Else if deployment already exists then do rollout of the existing pod making zero downtime for the user.
2. If application created first time, then expose the application. Else don’t expose it.















Comments
Post a Comment