2023-04-07 10:58:28 +02:00
|
|
|
pipeline {
|
|
|
|
agent any
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage('Pull git') {
|
2023-04-07 11:02:28 +02:00
|
|
|
steps {
|
|
|
|
checkout scm
|
|
|
|
}
|
2023-04-07 10:58:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
stage('Build Docker Image') {
|
|
|
|
steps {
|
|
|
|
script {
|
2023-04-18 17:15:08 +02:00
|
|
|
def dockerImage = docker.build('git.thisfro.ch/jenkinsci/pflaenzli', '-f Dockerfile . --tag git.thisfro.ch/jenkinsci/pflaenzli:${BUILD_NUMBER} --tag git.thisfro.ch/jenkinsci/pflaenzli:latest')
|
2023-04-07 10:58:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Push Docker Image') {
|
|
|
|
steps {
|
2023-04-18 16:42:45 +02:00
|
|
|
script {
|
2023-04-18 17:20:00 +02:00
|
|
|
sh 'echo "git.thisfro.ch/jenkinsci/pflaenzli:${BUILD_NUMBER}"'
|
2023-04-18 17:23:43 +02:00
|
|
|
def numberTagImage = docker.image("git.thisfro.ch/jenkinsci/pflaenzli:${BUILD_NUMBER}")
|
2023-04-18 16:42:45 +02:00
|
|
|
docker.withRegistry('https://git.thisfro.ch', 'jenkins-ci') {
|
2023-04-18 16:44:42 +02:00
|
|
|
numberTagImage.push()
|
2023-04-18 16:42:45 +02:00
|
|
|
}
|
2023-04-18 16:44:42 +02:00
|
|
|
|
|
|
|
def latestTagImage = docker.image('git.thisfro.ch/jenkinsci/pflaenzli:latest')
|
2023-04-07 10:58:28 +02:00
|
|
|
docker.withRegistry('https://git.thisfro.ch', 'jenkins-ci') {
|
2023-04-18 16:44:42 +02:00
|
|
|
latestTagImage.push()
|
2023-04-07 10:58:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|