-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
46 lines (42 loc) · 1.14 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
//Declarative format
pipeline {
agent any
//agent{ docker { image 'tariqbeans/node:latest'} }
environment {
dockerHome = tool 'myDocker'
PATH = "$dockerHome/bin:$PATH"
}
stages {
stage('Checkout from feature branch') {
steps {
echo "Build"
echo "PATH - $PATH"
sh 'docker version'
}
}
stage('Build Docker Image') {
steps {
echo "Build Image"
script{
app = docker.build("tariqbeans/cbk-demo")
}
}
}
stage('Push Docker Image') {
steps {
echo "Push Image to DockerHub"
script {
docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-cred') {
app.push("${env.BUILD_NUMBER}")
app.push("latest")
}
}
}
}
}
post {
always {
echo "I always run after post stages!!"
}
}
}