From 4c3d348aa79af8241ca0f059fc482562604f6565 Mon Sep 17 00:00:00 2001 From: surendratig <109063145+surendratig@users.noreply.github.com> Date: Mon, 15 Sep 2025 15:13:14 +0530 Subject: [PATCH] Create Jenkinsfile --- Jenkinsfile | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..04b41fb --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,62 @@ +#this pipelinefile is written by surendra +pipeline { + agent any + environment{ + scannerHome = tool 'mysonar' + } + stages { + stage ('clean WS') { + steps { + cleanWs() + } + } + stage ('code pull') { + steps { + git branch: 'main', url: 'https://github.com/devops0014/Zomato-Repo.git' + } + } + stage ('CQA') { + steps { + withSonarQubeEnv('mysonar') { + sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey='zomato'" + } + } + } + stage ('Qwality Gate') { + steps { + script { + waitForQualityGate abortPipeline: false, credentialsId: 'sonar-cred' + } + } + } + stage ('build') { + steps { + sh 'docker build -t image1 .' + } + } + stage ('trivy scan') { + steps { + sh 'trivy image image1' + } + } + stage ('tag') { + steps { + sh 'docker tag image1 surendra84/zomato:zomato1' + } + } + stage ('push') { + steps { + script { + withDockerRegistry(credentialsId: 'dockerhub-tok') { + sh 'docker push surendra84/zomato:zomato1' + } + } + } + } + stage ('docker deploy') { + steps { + sh 'docker run -itd --name zomato -p 3000:3000 surendra84/zomato:zomato1 ' + } + } + } +}