forked from lidorg-dev/node-hello
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
30 lines (26 loc) · 772 Bytes
/
Jenkinsfile
File metadata and controls
30 lines (26 loc) · 772 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
pipeline {
agent {
node {
label 'Docker-slave'
}
}
stages {
stage('Checkout code') {
steps {
git(url: 'https://github.com/lidorg-dev/node-hello.git', branch: 'master', changelog: true, poll: true)
}
}
stage('Build Docker Image') {
steps {
sh 'docker build . -t node-hello:$BUILD_ID'
}
}
stage('Push Docker Image') {
steps {
withDockerRegistry(credentialsId: 'docker-hub-creds', url: 'https://index.docker.io/v1/') {
sh '''docker tag node-hello:$BUILD_ID lidorlg/node-hello:$BUILD_ID && docker tag node-hello:$BUILD_ID lidorlg/node-hello:latest && docker push lidorlg/node-hello:$BUILD_ID && docker push lidorlg/node-hello:latest'''
}
}
}
}
}