-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
35 lines (26 loc) · 859 Bytes
/
Jenkinsfile
File metadata and controls
35 lines (26 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
node() {
def imageName = 'knowagelabs/knowage-python-docker-base'
def imageVersion = "2.0"
def builtImage = null
def commonDockerLabels = " --label maintainer=https://www.knowage-suite.com/"
def commonDockerBuildOpts = " "
stage('Checkout') {
checkout scm
}
stage('Build') {
sh 'echo Building ${imageName}:${imageVersion}'
builtImage = docker.build("${imageName}:${imageVersion}", "" + commonDockerLabels + commonDockerBuildOpts + " .")
}
stage('Push') {
docker.withRegistry('', 'docker-hub') {
builtImage.push("$imageVersion")
}
}
stage('Clean up') {
def hash = null
hash = sh(script: "docker image inspect --format='{{.Id}}' ${imageName}:${imageVersion}", returnStdout: true)
.trim()
.split(":")[1]
sh "docker rmi -f " + hash
}
}