An Introduction to CI/CD

Amit Sharma
3 min readMay 5, 2022

Take away from this article:

  • How to create a pipeline.
  • How to integrate docker with jenkins.
  • How to build docker image and push to docker hub.
  • How to deploy an application inside kubernetes cluster.

So, lets start by creating an simple application wriiten in html. Below is the code of the appliction. I have installed jenkins and minikube in different servers over aws as you can see below.

ec2-instances

Application Code:

Now lets create a Dockerfile. Below code will you to create dockerfile.

Dockerfile Code:

After creating docker image lets create jenkinsfile to create pipeline job in jenkins dashboard.

Jenkinsfile Code:

Adding GitHub Webhook in jenkins:

Adding Dockerhub credentials in jenkins:

Using Git as a SCM in pipeline script to pull jenkinsfile:

After saving the job run the job as soon as you commit the code from vscode then the jenkins pipeline will run automatically. Here how its look like.

Job run successfully:

Docker image pushed:

Application-Output:

--

--

Amit Sharma

2x RedHat || 2x GCP Certified || DEVOPS Enginner || Terraform || Ansible || Kubernetes || AWS || GCP || GitLab || Jenkins|| Openshift