-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjenkinsfile
More file actions
36 lines (31 loc) · 951 Bytes
/
jenkinsfile
File metadata and controls
36 lines (31 loc) · 951 Bytes
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
pipeline{
agent any
stages{
stage('Build-jar'){
steps{
bat "mvn clean package -DskipTests"
}
}
stage('Build-Image'){
steps{
bat "docker build -t=pramesh11/myprojectimage_oct24:latest ."
}
}
stage('Push-Image'){
environment{
DOCKER_HUB= credentials('dockerhub-credentials')
}
steps{
bat 'docker login -u %DOCKER_HUB_USR% -p %DOCKER_HUB_PSW%'
bat "docker push pramesh11/myprojectimage_oct24:latest"
bat "docker tag pramesh11/myprojectimage_oct24:latest pramesh11/myprojectimage_oct24:${env.BUILD_NUMBER}"
bat "docker push pramesh11/myprojectimage_oct24:${env.BUILD_NUMBER}"
}
}
}
post{
always{
bat "docker logout"
}
}
}