GitHub-Docker integration with Jenkins CI/CD

MAYANK VARSHNEY
4 min readJul 19, 2020

--

! TASK !

JOB#1

If Developer push to dev branch then Jenkins will fetch from dev and deploy on testing_environment.

JOB#2

If Developer push to master branch then Jenkins will fetch from master and deploy on production_environment. Both testing_environment and production_environment are on different docker containers.

JOB#3

Manually the QA team will check (test) for the website running in testing_environment. If it is running fine then Jenkins will merge the dev branch to master branch and trigger #job 2.

Step 1 :-

My job is started by creating a repository on GitHub :-

Step 2 :-

Then i created an HTML webpage , and after doing few steps i have uploaded it to the GitHub.

Step 3 :-

After that I have Created an Branch Which Is named dev and i had Changed some code and uploaded to the GitHub.

Step 4:-

Now we’ll create a workflow like the below image.

JOB#1

This will fetch the code from the developer branch.

JOB#2

This will fetch the code from the master branch.

JOB#3

Actually behind the scene Docker service is running on the machine and that have httpd image preinstalled and Jenkins is downloading the git files locally and run the docker container on port 82 and 83 with placing the respective files in the container and whenever it receive new files updated on the GitHub it Automatically download files locally and replacing the previous docker container . So site is updated with no downtime . And If the Developer Push the file in the master branch then it will automatically download and directly update the main site running on port 82 . If Developer push and change the file in dev branch, then it deployed in another site running on port 83 which the quality assurance team will verify manually and after visiting that URL will trigger the Job 3 on Jenkins . And Job 3 will merge to the dev branch with master branch and also trigger the Job 2 and the main site is updated without doing anything .

The Below Picture Is Taken on The behalf of Main website running on port 83 And Files is From GitHub master branch :-

The Below Picture Is Taken on The behalf of Secondary website running on port 82 And Files is From GitHub dev branch :-

And After Q&A Pass Post merging And after triggered that URL That Site is on our main Site :-

And This Is the Process is on our Main Machine.

So , That’s It . The Process And The Task is Completed Successfully.

GitHub Link: https://github.com/mayank-aly/mlops_task_1.git

--

--

MAYANK VARSHNEY

I am a forward-thinking individual with exceptional skills in problem-solving, adaptive thinking, automation, and development.