From f85d91e1ba5160992bc20d6983593598181145c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sat, 16 Sep 2023 23:42:08 +0200 Subject: [PATCH] add docker release stage to pipeline --- Jenkinsfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 12e6b26..ff6a00c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -61,5 +61,27 @@ pipeline { } } } + + stage('Release Docker image') { + steps { + script { + sh script 'git clean -ffdx', label 'Clean repository' + + def version = sh(script: 'git describe --tags --always --match "Release_*" HEAD', returnStdout: true).trim() + def imageUrl = "git.esoko.eu/esoko/mapguesser:${version}" + + sh script: """docker buildx build \ + -t ${imageUrl} \ + -f docker/Dockerfile \ + --target mapg_release \ + .""", + label: 'Build Docker image') + + withDockerRegistry([credentialsId: 'gitea-system-user', url: 'https://git.esoko.eu/']) { + sh script: "docker push ${image_url}", label: 'Push Docker image to registry' + } + } + } + } } }