Skip to main content

Command Palette

Search for a command to run...

Building a Notes App CI/CD Pipeline: Using GitHub, Docker Hub, and Jenkins

Updated
4 min read
Building a Notes App CI/CD Pipeline: Using GitHub, Docker Hub, and Jenkins
M

👋Hello I am Mohd Saif, passionate technology enthusiast currently pursuing a bachelor of Computer application degree.

🎓Education: I am currently pursuing a bachelor of Computer application degree with the focus on coding at Bareilly University my education journey has equipped me with strong foundation in Computer science and I am eager to apply my knowledge to real word challenges.

💡Passion for technology: I have always been deeply passionate about technology and I am particular drawn to devops with AWS.

🚀Skills: 🔹Linux 🔹Shell scripting 🔹Python 🔹Ansible 🔹Docker 🔹Kubernetes 🔹Jenkins CI/CD 🔹Maven 🔹Git and GitHub

✨Future goals: My goal is to facilitate seamless collaboration between development and operations teams, ensuring faster releases and high-quality software. I am a proactive learner, constantly exploring new DevOps trends and practices

In this blog, we will walk through setting up a CI/CD pipeline for a Notes application. We'll leverage GitHub for version control, Jenkins for continuous integration and deployment automation, Docker and DockerHub for containerization, and VMware Workstation 17 for hosting our application.

Prerequisites

  1. GitHub Account: Ensure you have a GitHub account and repository set up for your Notes application.

  2. Jenkins: Install Jenkins on your local machine or server.

  3. Docker: Install Docker on your local machine or server.

  4. DockerHub Account: Create a DockerHub account for storing your Docker images.

  5. VMware Workstation 17: Ensure you have an account on VMware workstation or EC2 instance with access the terminal.

Step 1: Setting up GitHub Repository

  1. Create a Repository: Go to GitHub and create a new repository for your Notes application.

    i have already created this repository t

    I have already created this repository.

  2. Push Your Code: Clone your repository locally and push your Notes application code to the repository.

    a) I cloned the project and entered the project directory using the cd command. Then, I used the commands git add . and git commit -m "your message".

    i cloed the project and enter that project by using commnad cd and  the i used command git add. , git commit -m command

    b) I set the URL with the repository URL using the git remote set-url command and pushed my project to the GitHub repository using the git push origin main command.

    i pushed my project on github

    c) Now, everyone can see this repository where I pushed my project to GitHub.

Step 2: Configuring Jenkins

  1. Install Jenkins Plugins: Ensure you have the necessary Jenkins plugins installed: GitHub Integration, Docker, and Pipeline.

    I have already installed all the necessary plugins, so I don't need any additional plugins.

  2. Create a New Job: In Jenkins, create a new Pipeline job.

  3. General: Now, let's add a description. Check the GitHub project option and enter the project URL.

  4. Build Triggers: Now, go to the build triggers option and check the GitHub hook trigger for GITscm polling.

  5. Pipeline: Now, choose Pipeline Script

    When writing the pipeline script, we need a Docker Hub account for pushing the image and credentials. Now, let's configure the credentials and Docker Hub account.

Step 3:Setting Up Docker Hub and Configuring Jenkins Credentials

To proceed, we need to set up a Docker Hub account and configure the Jenkins credentials.

  1. Open a Docker Hub account or create an account:

    I already have a Docker Hub account, so I don't need to create another one.

  2. Now, go to Manage Jenkins and configure the credentials using your Docker Hub account:

    click the system and take add credentials option then create a credentials ID

    Click on "System" and select "Add Credentials," then create a credentials ID.

    Now add the Docker Hub username and password along with a credentials ID, just like I did dockerHub and then save the credetials

    Now, add the Docker Hub username and password along with a credentials ID, just like I did with dockerHub, and then save the credentials.

Step 4: Now, go to the VMware terminal

  1. Login to Docker Hub: Log in to Docker Hub using the VMware Workstation terminal with the docker login command.

Step 5: Now, return to our Jenkins notes-app project

  1. Pipeline: Now, I need to add the credentials to the pipeline script I created.

    now apply and save this pipeline

    Now, apply and save this pipeline.

  2. Now build the pipeline :

    See everyone, we have successfully built our pipeline.

  3. Push and run the project: Now, we are going back to the pipeline script to add a few commands: sh "docker tag my-note-app ${env.dockerHubUser}/my-note-app:latest" and sh "docker push ${env.dockerHubUser}/my-note-app:latest".

    Now, apply and save the pipeline.

  4. Next, click "Build Now":

    My pipeline script successfully runs on port number 8000.

    Now, let's run our notes application using the IP address and port 8000.

    See everyone, it's ready for work. We successfully built, deployed, and ran our notes application.

Summary

In this blog, we have set up a complete CI/CD pipeline for a Notes application using GitHub, Jenkins, Docker, DockerHub, and VMware workstation. By following these steps, you can automate the process of building, testing, and deploying your applications seamlessly.