forked from artisantek/java-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
30 lines (29 loc) · 710 Bytes
/
Jenkinsfile
File metadata and controls
30 lines (29 loc) · 710 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 {label "new-node"}
environment {
Docker_Cred=credentials('Docker_Cred')
}
stages {
stage ('SCM checkout') {
steps {
git branch:'main', url:'https://github.com/asifkhazi/java-example-war.git'
}
}
stage ('Build and Create docker image') {
steps {
sh 'docker build -t ${Docker_Cred_USR}/tomcat:${BUILD_ID} -f Dockerfile1 .'
}
}
stage ('Push image to artifactory') {
steps {
sh 'docker login -u ${Docker_Cred_USR} -p ${Docker_Cred_PSW}'
sh 'docker push ${Docker_Cred_USR}/tomcat:${BUILD_ID}'
}
}
stage ('Deploy') {
steps {
sh 'docker run -itd --name cont-${BUILD_ID} -p 8080:8080 ${Docker_Cred_USR}/tomcat:${BUILD_ID}'
}
}
}
}