-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
executable file
·35 lines (23 loc) · 966 Bytes
/
Jenkinsfile
File metadata and controls
executable file
·35 lines (23 loc) · 966 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
node{
stage('SCM Checkout'){
git url: 'https://github.com/MithunTechnologiesDevOps/java-web-app-docker.git',branch: 'master'
}
stage(" Maven Clean Package"){
def mavenHome = tool name: "Maven", type: "maven"
def mavenCMD = "${mavenHome}/bin/mvn"
sh "${mavenCMD} clean package"
}
stage('Build Docker Image'){
sh 'docker build -t ouusssamaaa/java-web-app .'
}
stage('Push Docker Image'){
withCredentials([usernamePassword(credentialsId: 'Docker_Hub_Pwd', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) {
sh ''' docker login -u ${USERNAME} -p ${PASSWORD}
docker push ouusssamaaa/java-web-app
'''
}
}
stage('Run Docker Image In Dev Server'){
sh' docker run -d -p 8081:8080 --name java-web-app ouusssamaaa/java-web-app'
}
}