-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJenkinsfile1
25 lines (25 loc) · 882 Bytes
/
Jenkinsfile1
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
node{
stage('SCM Checkout'){
git credentialsId: 'git-hub', url: 'https://github.com/vinaykumarmanne/betterreads-webapp.git'
}
stage('Mvn Package'){
def mvnHome = tool name: 'maven', type: 'maven'
def mvnCMD = "${mvnHome}/bin/mvn"
sh "${mvnCMD} clean package"
}
stage('Build Docker Image'){
sh 'docker build -t chinnachowdary/myteam:1.0.0 .'
}
stage('Push Docker Image'){
withCredentials([string(credentialsId: 'docker-hub', variable: 'dockerHubPwd')]) {
sh "docker login -u chinnachowdary -p ${dockerHubPwd}"
}
sh 'docker push chinnachowdary/project1:1.0.0'
}
stage('Run Container on Dev Server'){
def dockerRun = 'docker run -p 8080:8080 -d --name my-app chinnachowdary/myteam:1.0.0'
sshagent(['mahi']) {
sh "ssh -o StrictHostKeyChecking=no [email protected] ${dockerRun}"
}
}
}