forked from shazforiot/HelloWorld-Springboot-App
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile3
45 lines (38 loc) · 1021 Bytes
/
Jenkinsfile3
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
pipeline{
agent any
environment {
DOCKERHUB_CREDENTIALS=credentials('dockerhub')
stages{
stage('Git clone') {
steps{
git 'https://github.com/sureshrajuvetukuri/HelloWorld-Springboot-App.git'
}
}
stage('maven build'){
steps{
sh 'mvn package'
}
}
stage('Create Dockerimage') {
steps{
sh 'docker build -t sureshrajuvetukuri/springboot:latest .'
}
}
stage('login') {
steps{
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'
}
}
stage('Push') {
steps{
sh 'docker push sureshrajuvetukuri/springboot:latest'
}
}
post {
always {
sh 'docker logout'
}
}
}
}
}