-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
35 lines (34 loc) · 1.08 KB
/
Jenkinsfile
File metadata and controls
35 lines (34 loc) · 1.08 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
pipeline{
agent any
tools{
maven 'Default'
}
environment {
PATH = "/usr/local/bin:$PATH" // Add this line to ensure Docker is found
}
stages{
stage('Build Maven'){
steps{
checkout (scmGit(branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[credentialsId: 'saravanan81java', url: 'https://github.com/saravanan81java/devops-springboot']]))
sh 'mvn clean install'
}
}
stage('Build docker image'){
steps{
script{
sh 'docker build -t saran81/devops-springboot-integration .'
}
}
}
stage('Push image to Hub'){
steps{
script{
withCredentials([string(credentialsId: 'dockerhubpwd', variable: 'dockerhubpwd')]) {
sh 'docker login -u saran81 -p ${dockerhubpwd}'
}
sh 'docker push saran81/devops-springboot-integration'
}
}
}
}
}