forked from SamPriyadarshi/addressbook
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathJenkinsfile
More file actions
29 lines (26 loc) · 844 Bytes
/
Jenkinsfile
File metadata and controls
29 lines (26 loc) · 844 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
node{
stage('Git upload'){
git credentialsId: 'demo', url: 'https://github.com/Prabhu4tx/addressbook'
}
stage('Maven build'){
def MavenHome = tool name: 'maven', type: 'maven'
def mvnCMD = "${MavenHome}/bin/mvn"
sh "${mvnCMD} clean compile"
sh "${mvnCMD} package"
}
stage ('docker build')
{
// sh "docker version"
sh " sudo docker build -t prabhu4029/myapp2:2.1.22 ."
}
stage ('push docker image')
{
withCredentials([string(credentialsId: 'dockerpwd', variable: 'dockerpwd')]) {
sh "sudo docker login -u prabhu4029 -p ${dockerpwd}"
}
sh 'sudo docker push prabhu4029/myapp2:2.1.22'
}
stage ('Run tomcatapp'){
sh 'sudo docker run -p 8080:8080 -d --name myapp2 prabhu4029/myapp2:2.1.22'
}
}