Skip to content

Commit

Permalink
Update pipeline-docker-ci-cd
Browse files Browse the repository at this point in the history
  • Loading branch information
javahometech authored May 11, 2018
1 parent f4ce505 commit b0e8bae
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion pipeline-docker-ci-cd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@


node{
stage('Git Checkout'){
git url: 'https://github.com/javahometech/my-app',
Expand All @@ -16,7 +17,25 @@ node{
withCredentials([string(credentialsId: 'docker-hub', variable: 'password')]) {
sh "docker login -u kammana -p ${password}"
}

sh 'docker push kammana/my-app:0.0.1'
}
stage('Remove Old Containers'){
sshagent(['my-app-dev']) {
try{
def sshCmd = 'ssh -o StrictHostKeyChecking=no [email protected]'
def dockerRM = 'docker rm -f my-app'
sh "${sshCmd} ${dockerRM}"
}catch(error){

}
}
}
stage('Deploy-Dev'){
sshagent(['my-app-dev']) {
input 'Deploy to Dev?'
def sshCmd = 'ssh -o StrictHostKeyChecking=no [email protected]'
def dockerRun = 'docker run -d -p 8080:8080 --name my-app kammana/my-app:0.0.1'
sh "${sshCmd} ${dockerRun}"
}
}
}

0 comments on commit b0e8bae

Please sign in to comment.