<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[DevOps project]]></title><description><![CDATA[DevOps project]]></description><link>https://devopsprojects1.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 23 Oct 2026 20:55:31 GMT</lastBuildDate><atom:link href="https://devopsprojects1.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Containerizing the application using Docker by implementing CI/CD tool Jenkins 🚀]]></title><description><![CDATA[In this project, we leverage Jenkins to create a robust CI/CD pipeline that integrates tools like Docker, Trivy, SonarQube, and OWASP Dependency Check to…]]></description><link>https://devopsprojects1.hashnode.dev/containerizing-the-application-using-docker-by-implementing-cicd-tool-jenkins</link><guid isPermaLink="true">https://devopsprojects1.hashnode.dev/containerizing-the-application-using-docker-by-implementing-cicd-tool-jenkins</guid><category><![CDATA[Jenkins]]></category><category><![CDATA[Docker]]></category><category><![CDATA[ci-cd]]></category><category><![CDATA[sonarqube]]></category><category><![CDATA[trivy]]></category><category><![CDATA[dockerhub]]></category><dc:creator><![CDATA[MAHESH BODICHERLA]]></dc:creator><pubDate>Thu, 15 May 2025 15:10:24 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1747320913517/23214682-c2fe-41ac-be3e-123cd48d6513.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this project, we leverage Jenkins to create a robust CI/CD pipeline that integrates tools like <strong>Docker</strong>, <strong>Trivy</strong>, <strong>SonarQube</strong>, and <strong>OWASP Dependency Check</strong> to deliver secure and high-quality software.</p>
<p><strong>Tools used:</strong></p>
<ol>
<li><p>GitHub</p>
</li>
<li><p>Jenkins</p>
</li>
<li><p>Docker</p>
</li>
<li><p>OWASP</p>
</li>
<li><p>Trivy</p>
</li>
<li><p>Sonarqube</p>
</li>
<li><p>NodeJS</p>
</li>
</ol>
<h3 id="heading-github"><strong>GitHub</strong></h3>
<p>GitHub is a platform for hosting and sharing code using Git. It helps developers collaborate by tracking changes, managing versions, and reviewing code. You can create repositories (repos) to store and organize projects. It also offers features like issue tracking and CI/CD workflows.</p>
<h3 id="heading-jenkins"><strong>Jenkins</strong></h3>
<p>Jenkins is an automation tool for building and deploying software. It uses pipelines to automate tasks like testing, building, and deploying code. It supports plugins to integrate with various tools. Jenkins makes Continuous Integration and Continuous Delivery (CI/CD) easy.</p>
<h3 id="heading-docker"><strong>Docker</strong></h3>
<p>Docker is a tool to create, share, and run lightweight virtualized environments called containers. Containers package code and dependencies together for consistent behavior across systems. It simplifies app deployment and avoids “it works on my machine” issues. Docker images are reusable blueprints for containers.</p>
<h3 id="heading-owasp"><strong>OWASP</strong></h3>
<p>OWASP (Open Web Application Security Project) focuses on improving web application security. It provides resources like the <strong>OWASP Top 10</strong>, a list of the most critical security risks in web apps. Developers use it as a guide to build secure applications. OWASP also creates free tools for security testing.</p>
<h3 id="heading-trivy"><strong>Trivy</strong></h3>
<p>Trivy is a security tool that scans containers, filesystems, and code for vulnerabilities. It detects issues like outdated dependencies and misconfigurations. Easy to use, it integrates with CI/CD pipelines to ensure secure builds. Trivy helps identify security risks early in the development process.</p>
<h3 id="heading-sonarqube"><strong>SonarQube</strong></h3>
<p>SonarQube analyzes code to find bugs, vulnerabilities, and code smells (poor practices). It gives a detailed report on code quality and suggests improvements. It supports multiple languages and integrates with CI/CD tools. SonarQube helps teams maintain clean, reliable, and secure code.</p>
<h3 id="heading-nodejs"><strong>Node.js</strong></h3>
<p>Node.js is a runtime that lets you run JavaScript outside the browser. It’s great for building fast and scalable server-side applications. Node.js uses non-blocking, event-driven programming for high performance. It’s commonly used for web servers, APIs, and real-time apps.</p>
<h3 id="heading-key-highlights"><strong>Key Highlights:</strong></h3>
<ol>
<li><p><strong>Code Quality Assurance</strong>:</p>
<ul>
<li><strong>SonarQube</strong> is used to analyze source code, ensuring it adheres to coding standards and detecting bugs, code smells, and vulnerabilities.</li>
</ul>
</li>
<li><p><strong>Vulnerability Scanning</strong>:</p>
<ul>
<li><p><strong>Trivy</strong> scans container images for known vulnerabilities, helping to secure the application at the image level.</p>
</li>
<li><p><strong>OWASP Dependency Check</strong> analyzes dependencies for vulnerabilities, ensuring no insecure libraries or frameworks are introduced.</p>
</li>
</ul>
</li>
<li><p><strong>Dockerized Environments</strong>:</p>
<ul>
<li>All stages of the pipeline run in Dockerized containers, ensuring consistency and simplifying environment management.</li>
</ul>
</li>
<li><p><strong>CI/CD Workflow</strong>:</p>
<ul>
<li><p>The pipeline automates <strong>build</strong>, <strong>test</strong>, and <strong>deploy</strong> processes, making it efficient and reliable.</p>
</li>
<li><p>Security and quality checks are seamlessly integrated into the pipeline, ensuring every release is both secure and robust.</p>
</li>
</ul>
</li>
</ol>
<p><strong>GitHub Repo:</strong></p>
<p><a target="_blank" href="https://github.com/devops0014/Zomato-Project.git"><strong>https://github.com/devops0014/Zomato-Project.git</strong></a></p>
<p>Lets implement it step-by-step,</p>
<p><strong>STEP-1: Launch EC2 Instance with below Configurations</strong></p>
<ol>
<li><p>AMI : Amazon Linux Kernel 5.10</p>
</li>
<li><p>Instance Type: T2.Large</p>
</li>
<li><p>EBS Volume : 20+ GB</p>
</li>
<li><p>Security Groups : All Traffic</p>
</li>
</ol>
<p><strong>STEP-2: Install Jenkins</strong></p>
<pre><code class="lang-plaintext">#! /bin/bash
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo 
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
yum install java-17-amazon-corretto -y 
yum install jenkins -y
systemctl start jenkins.service 
systemctl enable jenkins.service 
systemctl status jenkins.service
</code></pre>
<p><strong>STEP-3: Install Docker &amp; GIT</strong></p>
<pre><code class="lang-plaintext">yum install docker git -y
systemctl start docker
systemctl status docker
chmod 777 ///var/run/docker.sock
</code></pre>
<p><strong>STEP-4: Install Sonarqube</strong></p>
<pre><code class="lang-plaintext">docker run -d --name sonar -p 9000:9000 sonarqube:lts-community
</code></pre>
<p>Now our sonarqube is up and running</p>
<p>Now our sonarqube is up and running on Port :9000</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*IanEEHI4q1za8HuAHYZ86A.png" alt /></p>
<p>username - admin<br />password - admin</p>
<p>Now our sonarqube is up and running</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*kaK8UAPRXhBO39-P5J92LQ.png" alt /></p>
<p>Update New password, This is Sonar Dashboard.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*0zmto6Qoi481Wmnl7zQ9Dg.png" alt /></p>
<p><strong>STEP-5: Install Trivy</strong></p>
<pre><code class="lang-plaintext">wget https://github.com/aquasecurity/trivy/releases/download/v0.18.3/trivy_0.18.3_Linux-64bit.tar.gz
tar zxvf trivy_0.18.3_Linux-64bit.tar.gz
sudo mv trivy /usr/local/bin/
echo 'export PATH=$PATH:/usr/local/bin/' &gt;&gt; ~/.bashrc
source .bashrc
trivy --version
</code></pre>
<p><strong>STEP-6: Install the following dependencies on Jenkins</strong></p>
<ol>
<li><p>Sonarqube Scanner</p>
</li>
<li><p>Eclipse Temurin Installer</p>
</li>
<li><p>NodeJS</p>
</li>
<li><p>OWASP Dependency-Check</p>
</li>
<li><p>Docker Pipeline</p>
</li>
</ol>
<p><strong>STEP-7: Integrate all the tools to Jenkins</strong></p>
<p>Go to Jenkins Dashboard → Manage Jenkins → Tools</p>
<p>JDK installations — v17</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*9HTWcpRK8YUwHYQJ3pRZ3g.png" alt /></p>
<p>NodeJS installations — v 16</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*sehkwhQNILJKZ5eiW7AgWw.png" alt /></p>
<p>Dependency-Check installations</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*IXRiU0Z8JXgcTS2riAAxfg.png" alt /></p>
<p>SonarQube Scanner installations</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*RC76GNgaRzr7GaFb_lWf1Q.png" alt /></p>
<p>After that click on apply</p>
<p><strong>STEP-8: Configure Sonar with Jenkins</strong></p>
<p>Goto your Sonarqube Server. Click on Administration → Security → Users → Click on Tokens and Update Token → Give it a name → and click on Generate Token</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*4NN9U4jaTkeD0-9t__wKlQ.png" alt /></p>
<p>click on update Token</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*sMqrkhjAwZYzD3oW8QyzEA.png" alt /></p>
<p>Create a token with a name and generate</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*603Z2dMmgoorUYN6KB9fkQ.png" alt /></p>
<p>copy Token</p>
<p>Goto Jenkins Dashboard → Manage Jenkins → Credentials → System → Global credentials (unrestricted) → Add Secret Text</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*jnJY0SAUa__suKEy_WkmlQ.png" alt /></p>
<p>Enter detail and click on create</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*dGfJo7U2Haaz97B0FP4Qow.png" alt /></p>
<p>Now, go to Dashboard → Manage Jenkins → System and Add like the below image.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*1Hmlw4sKpV27pbGIBhdAUA.png" alt /></p>
<p>Click on Apply and Save</p>
<p><strong>STEP-9: Add Dockerhub Credentials</strong></p>
<p>Goto Jenkins Dashboard → Manage Jenkins → Credentials → System → Global credentials (unrestricted) → Add Username and password</p>
<p>username : dockerhub-username</p>
<p>password: dockerhub-password</p>
<p>credentials id : docker-password</p>
<p>Click on Apply and Save</p>
<p><strong>STEP-10: Create a Jenkins Job</strong></p>
<p>Goto Jenkins Dashboard create a job as My-Deployment Name, select pipeline and click on ok.</p>
<pre><code class="lang-plaintext">pipeline {
    agent any
    tools {
        jdk 'jdk17'
        nodejs 'node16'
    }
    environment {
        SCANNER_HOME=tool 'sonar-server'
    }
    stages {
        stage ("clean workspace") {
            steps {
                cleanWs()
            }
        }
        stage ("Checkout from Git") {
            steps {
                git branch: 'main', url: 'https://github.com/devops0014/Zomato-Repo.git'
            }
        }
        stage("Sonarqube Analysis") {
            steps{
                withSonarQubeEnv('mysonar') {
                    sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=zomato \
                    -Dsonar.projectKey=zomato '''
                }
            }
        }
        stage ("quality gate") {
            steps {
                script {
                    waitForQualityGate abortPipeline: false, credentialsId: 'Sonar-Token'
                }
            }
        }
        stage ("Install dependencies") {
            steps {
                sh 'npm install'
            }
        }
        stage ("OWASP FS SCAN") {
            steps {
                dependencyCheck additionalArguments: '--scan ./ --disableYarnAudit --disableNodeAudit', odcInstallation: 'DP-Check'
                dependencyCheckPublisher pattern: '**/dependency-check-report.xml'
            }
        }
        stage ("TRIVY FS SCAN") {
            steps {
                sh "trivy fs . &gt; trivyfs.txt"
            }
        }
        stage("Docker Build &amp; Push"){
            steps{
                script{
                    withDockerRegistry(credentialsId: 'docker-password') {
                        sh 'docker build -t image1 .'
                        sh "docker tag image1 shaikmustafa/loki:mydockerimage"
                        sh "docker push shaikmustafa/loki:mydockerimage"
                    }
                }
            }
        }
        stage ("TRIVY") {
            steps {
                sh 'trivy image shaikmustafa/loki:mydockerimage'
            }
        }
        stage ("Deploy to container") {
            steps {
                sh 'docker run -d --name zomato -p 3000:3000 shaikmustafa/loki:mydockerimage'
            }
        }
    }
}
</code></pre>
<p>If you click on <strong>Build Now</strong> pipeline will start again</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732351576299/74ae9b0f-63c4-457e-86a0-b8abe97eeff3.png?auto=compress,format&amp;format=webp" alt /></p>
<p><strong>Dependency-Chek Trend</strong></p>
<p><img src="https://miro.medium.com/v2/resize:fit:1110/1*LP61yYd3MWjSsBoHG6kXrA.png" alt /></p>
<p><strong>Sonarqube report</strong></p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*AmHoVGaP5ukNhmBLQFeZIw.png" alt /></p>
<p><strong>Dependency-Check Results</strong></p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*lCpIerrpqyf0paDYtAwzDQ.png" alt /></p>
<p><strong>Docker hub registry image</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732351711918/a5bc1c9d-6e37-4a1f-9901-838d54e43b69.png?auto=compress,format&amp;format=webp" alt /></p>
<p>stage view</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*UruzUzwT3peIuTjq8w4H9w.png" alt /></p>
<p>Deployed website</p>
<p><a target="_blank" href="http://192.168.62.129:3000/"><strong>http://&lt;Jenk</strong></a>ins-public-<a target="_blank" href="http://192.168.62.129:3000/"><strong>ip:3000</strong></a>\&gt;</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*hM9PG_qx9maFpWgg5Eh3Hg.png" alt /></p>
<p>Thanks me later 👋</p>
<p><strong>Thanks for Reading!</strong></p>
<p>I hope you found this article insightful and helpful. If you'd like to connect or discuss more on this topic, feel free to reach out on LinkedIn.<br /><a target="_blank" href="http://LinkedIn.com/mahesh-bodicherla">LinkedIn URL</a></p>
]]></content:encoded></item></channel></rss>