From 6432085a52e52f6b1fec34635cc5b35c4d22c61c Mon Sep 17 00:00:00 2001 From: Andreas Dinauer Date: Thu, 5 Jun 2025 22:04:55 +0200 Subject: [PATCH] :construction_worker: Add jenkinsfile --- Jenkinsfile | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..cfc747d --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,31 @@ +pipeline { + agent any + + stages { + stage('Set Image Name') { + steps { + script { + env.IMAGE = "harbor.dinauer.dev/kubooboo/frontend:${env.BUILD_NUMBER}"; + } + } + } + stage('Build Image') { + steps { + script { + sh "docker build --no-cache -t ${env.IMAGE} ." + } + } + } + stage('Push Image to Docker Hub') { + steps { + script { + withCredentials([usernamePassword(credentialsId: 'harbor', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { + sh 'echo ${PASSWORD} | docker login harbor.dinauer.dev -u ${USERNAME} --password-stdin' + sh "docker push ${env.IMAGE}" + sh "docker logout harbor.dinauer.dev" + } + } + } + } + } +} \ No newline at end of file