👷 Add jenkinsfile

This commit is contained in:
Andreas Dinauer 2025-06-05 21:58:13 +02:00
parent db77add4db
commit 15859815bc
2 changed files with 39 additions and 1 deletions

View File

@ -7,7 +7,7 @@
# #
# Then, build the image with: # Then, build the image with:
# #
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/kubeman-jvm . # docker build -f src/main/docker/Dockerfile -t quarkus/kubeman-jvm .
# #
# Then run the container using: # Then run the container using:
# #

38
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,38 @@
pipeline {
agent any
stages {
stage('Set Image Name') {
steps {
script {
env.IMAGE = "harbor.dinauer.dev/kubooboo/backend:${env.BUILD_NUMBER}";
}
}
}
stage('Build Quarkus application') {
steps {
script {
sh 'mvn clean install'
}
}
}
stage('Build Docker 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"
}
}
}
}
}
}