-
Notifications
You must be signed in to change notification settings - Fork 127
Expand file tree
/
Copy pathJenkinsfile
More file actions
63 lines (52 loc) · 1.45 KB
/
Jenkinsfile
File metadata and controls
63 lines (52 loc) · 1.45 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
pipeline {
agent any
stages {
stage('Compile and Clean') {
steps {
sh "mvn clean compile"
}
}
stage('Test') {
steps {
sh "mvn test site"
}
post {
always {
junit allowEmptyResults: true, testResults: 'target/surefire-reports/*.xml'
}
}
}
stage('deploy') {
steps {
sh "mvn package"
}
}
stage('Build Docker image'){
steps {
sh 'docker build -t anvbhaskar/docker_jenkins_pipeline:${BUILD_NUMBER} .'
}
}
stage('Docker Login'){
steps {
withCredentials([string(credentialsId: 'DockerId', variable: 'Dockerpwd')]) {
sh "docker login -u anvbhaskar -p ${Dockerpwd}"
}
}
}
stage('Docker Push'){
steps {
sh 'docker push anvbhaskar/docker_jenkins_pipeline:${BUILD_NUMBER}'
}
}
stage('Docker deploy'){
steps {
sh 'docker run -itd -p 8081:8080 anvbhaskar/springboot:0.0.3'
}
}
stage('Archving') {
steps {
archiveArtifacts '**/target/*.jar'
}
}
}
}