File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ pipeline {
2+ agent any
3+ tools {
4+ maven " 3.8.5"
5+
6+ }
7+ stages {
8+ stage(' Compile and Clean' ) {
9+ steps {
10+ // Run Maven on a Unix agent.
11+
12+ sh " mvn clean compile"
13+ }
14+ }
15+ stage(' deploy' ) {
16+
17+ steps {
18+ sh " mvn package"
19+ }
20+ }
21+ stage(' Build Docker image' ){
22+
23+ steps {
24+ echo " Hello Java Express"
25+ sh ' ls'
26+ sh ' docker build -t anvbhaskar/docker_jenkins_springboot:${BUILD_NUMBER} .'
27+ }
28+ }
29+ stage(' Docker Login' ){
30+
31+ steps {
32+ withCredentials([string(credentialsId : ' DockerId' , variable : ' Dockerpwd' )]) {
33+ sh " docker login -u anvbhaskar -p ${ Dockerpwd} "
34+ }
35+ }
36+ }
37+ stage(' Docker Push' ){
38+ steps {
39+ sh ' docker push anvbhaskar/docker_jenkins_springboot:${BUILD_NUMBER}'
40+ }
41+ }
42+ stage(' Docker deploy' ){
43+ steps {
44+
45+ sh ' docker run -itd -p 8081:8080 anvbhaskar/docker_jenkins_springboot:${BUILD_NUMBER}'
46+ }
47+ }
48+ stage(' Archving' ) {
49+ steps {
50+ archiveArtifacts ' **/target/*.jar'
51+ }
52+ }
53+ }
54+ }
You can’t perform that action at this time.
0 commit comments