Edit Jenkinsfile

This commit is contained in:
Viktoriia Karpenko 2024-12-20 14:45:36 +02:00
parent b63e92337f
commit f7802e82c0

22
Jenkinsfile vendored
View file

@ -24,16 +24,16 @@ pipeline {
archiveArtifacts artifacts: 'target/*.jar', allowEmptyArchive: false
}
}
stage ('Creating Docker image') {
steps {
sh 'docker build -t vkarpenko02/mr:${GIT_COMMIT} .'
withCredentials([usernamePassword(credentialsId: 'docker_key', usernameVariable: 'DOCKER_HUB_USER', passwordVariable: 'DOCKER_HUB_PASS')]) {
sh """
echo ${DOCKER_HUB_PASS} | docker login -u ${DOCKER_HUB_USER} --password-stdin
docker push vkarpenko02/mr:${GIT_COMMIT}
"""
}
}
}
// stage ('Creating Docker image') {
// steps {
// sh 'docker build -t vkarpenko02/mr:${GIT_COMMIT} .'
// withCredentials([usernamePassword(credentialsId: 'docker_key', usernameVariable: 'DOCKER_HUB_USER', passwordVariable: 'DOCKER_HUB_PASS')]) {
// sh """
// echo ${DOCKER_HUB_PASS} | docker login -u ${DOCKER_HUB_USER} --password-stdin
// docker push vkarpenko02/mr:${GIT_COMMIT}
// """
// }
// }
// }
}
}