forked from wywywywy/docker_stats_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
62 lines (62 loc) · 1.48 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
pipeline {
agent {
docker {
image 'node:8-alpine'
args '-v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker'
}
}
// triggers {
// cron('H 10 * * 2')
// }
// environment {
// XXX = 'xxx'
// }
options {
buildDiscarder(
logRotator(
daysToKeepStr: '30',
artifactDaysToKeepStr: '30'
)
)
}
stages {
// stage('Init') {
// steps {
// }
// }
stage('Build Backend docker image') {
steps {
// sh 'DATE=$(date +"%Y%m%d")'
// sh 'docker build -t wywywywy/docker_stats_exporter:latest -t wywywywy/docker_stats_exporter:$DATE .'
sh """
DATE=\$(date +"%Y%m%d")
docker build -t wywywywy/docker_stats_exporter:latest -t wywywywy/docker_stats_exporter:\$DATE .
"""
}
}
stage('Push Backend docker image to repo') {
steps {
withCredentials([usernamePassword(credentialsId: 'dockerHub', passwordVariable: 'dockerHubPassword', usernameVariable: 'dockerHubUser')]) {
sh """
DATE=\$(date +"%Y%m%d")
docker login -u ${env.dockerHubUser} -p ${env.dockerHubPassword}
docker push wywywywy/docker_stats_exporter:\$DATE
docker push wywywywy/docker_stats_exporter:latest
"""
}
}
}
}
// post {
// always {
// }
// success {
// }
// unstable {
// }
// failure {
// }
// aborted {
// }
// }
}