Skip to content

Commit 11e7c45

Browse files
build(ci): build & publish Docker image to repo.heigit.org
1 parent b18fe01 commit 11e7c45

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

Jenkinsfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ pipeline {
1515
RELEASE_REGEX = /^([0-9]+(\.[0-9]+)*)(-(RC|beta-|alpha-)[0-9]+)?$/
1616
RELEASE_DEPLOY = false
1717
SNAPSHOT_DEPLOY = false
18+
19+
DOCKER_CREDENTIALS_ID = 'docker-heigit-ci-service'
1820
}
1921

2022
stages {
@@ -65,6 +67,45 @@ pipeline {
6567
}
6668
}
6769

70+
stage('Build and publish Docker image for main') {
71+
agent {
72+
kubernetes {
73+
inheritFrom "BASE DOCKER"
74+
}
75+
}
76+
when {
77+
branch 'main'
78+
}
79+
steps {
80+
container('docker') {
81+
withCredentials([usernamePassword(credentialsId: DOCKER_CREDENTIALS_ID, usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
82+
sh 'docker login -p $PASSWORD -u $USERNAME repo.heigit.org'
83+
}
84+
sh "docker build --push --builder=kube --platform=linux/amd64 -t repo.heigit.org/heigit/sketch-map-tool:main ."
85+
}
86+
}
87+
}
88+
89+
stage('Build and publish Docker image for release') {
90+
agent {
91+
kubernetes {
92+
inheritFrom "BASE DOCKER"
93+
}
94+
}
95+
when {
96+
buildingTag()
97+
}
98+
steps {
99+
container('docker') {
100+
withCredentials([usernamePassword(credentialsId: DOCKER_CREDENTIALS_ID, usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
101+
sh 'docker login -p $PASSWORD -u $USERNAME repo.heigit.org'
102+
}
103+
sh "docker build --push --builder=kube --platform=linux/amd64 -t repo.heigit.org/heigit/sketch-map-tool:${env.TAG_NAME} ."
104+
sh "docker build --push --builder=kube --platform=linux/amd64 -t repo.heigit.org/heigit/sketch-map-tool:latest ."
105+
}
106+
}
107+
}
108+
68109
stage('Test') {
69110
environment {
70111
VIRTUAL_ENV="${WORKSPACE}/.venv"

0 commit comments

Comments
 (0)