minor fix

main
Cizz22 1 year ago
parent 96b936b68f
commit 3acc5df0c2

6
Jenkinsfile vendored

@ -35,9 +35,10 @@ pipeline {
steps { steps {
script { script {
// Build with commit hash tag // Build with commit hash tag
APP_GIT_HASH = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
sh ''' sh '''
docker build -t ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:latest . docker build -t ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:latest .
docker tag ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:latest ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:${GIT_COMMIT_HASH} docker tag ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:latest ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:${APP_GIT_HASH}
''' '''
} }
} }
@ -45,9 +46,10 @@ pipeline {
stage('Push to Docker Hub') { stage('Push to Docker Hub') {
steps { steps {
APP_GIT_HASH = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
sh ''' sh '''
# Push both tags # Push both tags
docker push ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:${GIT_COMMIT_HASH} docker push ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:${APP_GIT_HASH}
docker push ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:latest docker push ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:latest
''' '''
} }

Loading…
Cancel
Save