forked from mesosphere-backup/vny
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkinsfile
30 lines (27 loc) · 830 Bytes
/
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
def gitCommit() {
sh "git rev-parse HEAD > GIT_COMMIT"
def gitCommit = readFile('GIT_COMMIT').trim()
sh "rm -f GIT_COMMIT"
return gitCommit
}
node {
// Checkout source code from Git
stage 'Checkout'
checkout scm
// Build Docker image
stage 'Build'
sh "docker build -t mesosphere/vny:${gitCommit()} ."
// Log in and push image to GitLab
stage 'Publish'
withCredentials(
[[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'dockerhub-mesosphere',
passwordVariable: 'DOCKERHUB_PASSWORD',
usernameVariable: 'DOCKERHUB_USERNAME'
]]
) {
sh "docker login -u ${env.DOCKERHUB_USERNAME} -p ${env.DOCKERHUB_PASSWORD} -e demo@mesosphere.com"
sh "docker push mesosphere/vny:${gitCommit()}"
}
}