added docker stage

This commit is contained in:
prasannakumar 2024-06-21 09:19:33 +05:30
parent e660614717
commit 8bafe17be3

6
Jenkinsfile vendored
View file

@ -8,6 +8,8 @@ pipeline {
environment { environment {
SONAR_AUTH_TOKEN = credentials('SONAR_AUTH_TOKEN') // Assumes you have stored your token in Jenkins Credentials SONAR_AUTH_TOKEN = credentials('SONAR_AUTH_TOKEN') // Assumes you have stored your token in Jenkins Credentials
DOCKER_REGISTRY_CREDENTIALS = credentials('prasannakumarsinganamalla431/****** (dockerhub)')
} }
@ -57,11 +59,11 @@ pipeline {
sh 'mvn clean package -DskipTests' sh 'mvn clean package -DskipTests'
} }
} }
stage('Build & push Docker Image') { stage('Building Docker Image') {
steps { steps {
script { script {
withDockerRegistry('Docker') { withDockerRegistry(credentialsId: 'DOCKER_REGISTRY_CREDENTIALS',registryUrl: "https://hub.docker.com/") {
sh "docker build -t prasannakumarsinganamalla431/petclinic:${BUILD_NUMBER} ." sh "docker build -t prasannakumarsinganamalla431/petclinic:${BUILD_NUMBER} ."