-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfileJavaWebApp
More file actions
56 lines (43 loc) · 1.19 KB
/
JenkinsfileJavaWebApp
File metadata and controls
56 lines (43 loc) · 1.19 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
pipeline{
tools {
maven 'maven3.9.0'
}
environment{
Version = "${env.BUILD_NUMBER}"
Docker_Username = "gundurakesh"
ApplicationName = "javawebapp"
ImageName = "${Docker_Username}" + "/" + "${ApplicationName}"
Docker_Cred = "dockerpwd"
}
agent any
stages{
stage("Build with Maven"){
steps{
sh "mvn clean package"
}
}
stage("Build Docker image"){
steps{
script{
docker_image = docker.build ("${ImageName}:${Version}", "." )
}
}
}
stage("Login into dockerhub & Push Docker image to dockerhub"){
steps{
script{
docker.withRegistry('',Docker_Cred){
docker_image.push()
}
}
}
}
stage("Deploy into Kubernetes Cluster"){
steps{
script{
sh "kubectl apply -f Kubernetes/deployment.yaml"
}
}
}
}
}