-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
31 lines (31 loc) · 936 Bytes
/
Jenkinsfile
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
pipeline {
agent any
tools{
maven 'maven_3_8_6'
}
stages{
stage('Build Maven'){
steps{
checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/himash79/Spring-boot-Devops-Pipeline']]])
sh 'mvn clean install'
}
}
stage('Build docker image'){
steps{
script{
sh 'docker build -t himash/devops-integration .'
}
}
}
stage('Push image to Hub'){
steps{
script{
withCredentials([string(credentialsId: 'dockerhub-pwd', variable: 'dockerhubpwd')]) {
sh 'docker login -u himash -p ${dockerhubpwd}'
}
sh 'docker push himash/devops-integration'
}
}
}
}
}