From 23e2c9890fa3bd7392d8894f75c59e0825d02480 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 19 Jul 2024 13:11:26 +0200 Subject: [PATCH] feat: jenkins push docker imagen by branch --- Jenkinsfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 19f47c5b0..13dd7749d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -89,6 +89,11 @@ pipeline { sh 'pnpm install --prefer-offline --prefix=front' } } + stage('Push image') { + steps { + sh 'docker tag $IMAGE:$TAG $IMAGE:$BRANCH_NAME' + } + } } } stage('Stack') { @@ -183,6 +188,10 @@ pipeline { } sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY' sh 'docker-compose push' + if (env.BRANCH_NAME == 'master') { + sh 'docker tag $IMAGE:$TAG $IMAGE:latest' + sh 'docker push $IMAGE:latest' + } } } stage('Deploy') {