forked from dall49/my-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
28 lines (22 loc) · 779 Bytes
/
Jenkinsfile
File metadata and controls
28 lines (22 loc) · 779 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
node{
stage("SCM Checkout"){
git credentialsId: 'git-credentials', url: 'https://github.com/dall49/my-app.git'
}
stage("MVN package"){
def mvnHome = tool name: 'maven-tool', type: 'maven'
def mvnCMD = "${mvnHome}/bin/mvn"
sh "${mvnCMD} clean package"
}
stage("Build Docker Image"){
sh "docker build -t dall49/my-app:1.1.0 ."
}
stage("Push Docker Image"){
withCredentials([string(credentialsId: 'docker-pwd', variable: 'dockerHubPwd')]) {
sh "docker login -u dall49 -p ${dockerHubPwd}"
}
sh "docker push dall49/my-app:1.1.0"
}
stage("Run Container on Dev Server"){
sh "docker run -d -p 8081:8080 --name my-app-v2 dall49/my-app:1.1.0"
}
}