Fix image tagging
This commit is contained in:
parent
53bcce2b98
commit
cbd3b0fcb1
1 changed files with 3 additions and 2 deletions
5
Jenkinsfile
vendored
5
Jenkinsfile
vendored
|
|
@ -48,11 +48,12 @@ pipeline {
|
|||
}
|
||||
}
|
||||
steps {
|
||||
sh 'docker build -t $IMAGE_NAME:$GIT_COMMIT -f docker/Dockerfile .'
|
||||
def tagName = env.ref?.replaceFirst(/^refs\/tags\//, '')
|
||||
sh "docker build -t $IMAGE_NAME:${tagName} -f docker/Dockerfile ."
|
||||
withCredentials([usernamePassword(credentialsId: "$DOCKER_CREDENTIALS_ID", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
|
||||
sh """
|
||||
echo "$PASSWORD" | docker login $REGISTRY -u "$USERNAME" --password-stdin
|
||||
docker push $IMAGE_NAME:$GIT_COMMIT
|
||||
docker push $IMAGE_NAME:${tagName}
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue