-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
48 lines (42 loc) · 1.11 KB
/
Jenkinsfile
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
36
37
38
39
40
41
42
43
44
45
46
47
48
pipeline {
agent any
environment {
// Tag: latest
BASE_IMAGE_LATEST = "ripl/libbot2:latest"
BUILD_IMAGE_LATEST = "ripl/libbot2-ros:latest"
// Tag: trusty
BASE_IMAGE_TRUSTY = "ripl/libbot2:trusty"
BUILD_IMAGE_TRUSTY = "ripl/libbot2-ros:trusty"
}
stages {
stage('Update Base Image') {
steps {
sh 'docker pull $BASE_IMAGE_LATEST'
sh 'docker pull $BASE_IMAGE_TRUSTY'
}
}
stage('Build Image') {
steps {
sh 'docker build -t $BUILD_IMAGE_LATEST -f Dockerfile ./'
sh 'docker build -t $BUILD_IMAGE_TRUSTY -f Dockerfile_trusty ./'
}
}
stage('Push Image') {
steps {
withDockerRegistry(credentialsId: 'DockerHub', url: 'https://index.docker.io/v1/') {
sh 'docker push $BUILD_IMAGE_LATEST'
sh 'docker push $BUILD_IMAGE_TRUSTY'
}
}
}
stage('Clean up') {
steps {
sh 'docker rmi $BUILD_IMAGE_LATEST'
sh 'docker rmi $BASE_IMAGE_LATEST'
sh 'docker rmi $BUILD_IMAGE_TRUSTY'
sh 'docker rmi $BASE_IMAGE_TRUSTY'
cleanWs()
}
}
}
}