Skip to content

Commit 426eb45

Browse files
authored
Merge pull request #138 from Nohit-Java17/develop
update pipeline
2 parents 10d3010 + 97d3049 commit 426eb45

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

Jenkinsfile

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ pipeline {
44
stages {
55
stage('Build') {
66
steps {
7-
sh 'docker build -t ecommerce:latest .'
7+
sh 'docker build -t yamiannephilim/ecommerce:latest .'
8+
}
9+
}
10+
11+
stage('Pushing') {
12+
steps {
13+
withDockerRegistry(credentialsId: 'dockerhub', url: 'https://index.docker.io/v1/') {
14+
sh 'docker push yamiannephilim/springboot'
15+
}
816
}
917
}
1018

@@ -22,8 +30,17 @@ pipeline {
2230

2331
stage('Run') {
2432
steps {
25-
sh 'docker run --name ecommerce --network yan --restart=unless-stopped -d ecommerce:latest'
33+
sh 'docker container stop ecommerce || echo "this container does not exist"'
34+
sh 'docker network create yan || echo "this network exist"'
35+
sh 'echo y | docker container prune'
36+
sh 'docker run --name ecommerce --network yan --restart=unless-stopped -d yamiannephilim/ecommerce:latest'
2637
}
2738
}
2839
}
40+
41+
post {
42+
always {
43+
cleanWs()
44+
}
45+
}
2946
}

0 commit comments

Comments
 (0)