forked from durganaidu191604/my-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
javahometech
authored
May 11, 2018
1 parent
f4ce505
commit b0e8bae
Showing
1 changed file
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
|
@@ -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}" | ||
} | ||
} | ||
} |