Docker login stage

This commit is contained in:
JustFiesta 2024-04-30 11:08:05 +02:00
parent 559581b643
commit 69adb9c27a

16
Jenkinsfile vendored
View file

@ -31,9 +31,21 @@ pipeline {
stage('Docker Build') { stage('Docker Build') {
steps { steps {
echo 'Building docker Image' echo 'Building docker Image'
sh 'docker build -t $NEXUS_DOCKER_REPO/spring-petclinic:${GIT_COMMIT} .' sh 'docker build -t $NEXUS_DOCKER_REPO/spring-petclinic:${GIT_COMMIT} .'
}
}
stage('Docker Login') {
steps {
echo 'Nexus Docker Repository Login'
script{
withCredentials([usernamePassword(credentialsId: 'nexus-cred', usernameVariable: 'USER', passwordVariable: 'PASS' )]){
sh ' echo $PASS | docker login -u $USER --password-stdin $NEXUS_DOCKER_REPO'
}
} }
}
} }
} }