Update Jenkinsfile

This commit is contained in:
Stas Bezuhlyi 2021-04-08 18:48:49 +03:00 committed by GitHub
parent 27d904196a
commit 8ccf5b22f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

13
Jenkinsfile vendored
View file

@ -33,11 +33,18 @@ pipeline {
}
stage('Push artifact to docker registry') {
steps {
withDockerRegistry(credentialsId: 'dockerhub_id') {
sh "docker push rodley/pet-clinic:${BUILD_NUMBER}"
}
script {
def dockerImage = docker.build("${env.IMAGE_NAME}", "-f ${env.DOCKERFILE_NAME} .")
docker.withRegistry('', 'dockerhub-creds') {
dockerImage.push()
dockerImage.push("latest")
}
echo "Pushed Docker Image: ${env.IMAGE_NAME}"
}
sh "docker rmi ${env.IMAGE_NAME} ${env.IMAGE_NAME_LATEST}"
}
}
stage('Deploy') {
steps {
echo 'Deploying....'