-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
40 lines (31 loc) · 858 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
32
33
34
35
36
37
38
39
pipeline {
agent any
tools {
// Install the Maven version configured as "M3" and add it to the path.
maven "maven"
}
stages {
stage("Checkout code") {
steps {
git branch: 'main', url: 'https://github.com/shivam779823/Jenkins-maven-cicd.git'
}
}
stage("build Jar") {
steps {
sh 'mvn -B -DskipTests clean package'
}
}
stage("Build image") {
steps {
script {
dockerImage = docker.build("shiva9921/javaapp")
}
}
}
stage("Push image") {
steps{
sh 'docker run -t javaapp -p 5000:5000 shiva9921/javaapp '
}
}
}
}