forked from srinivas1987devops/myweb
-
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
Jan 19, 2019
1 parent
062ed8e
commit d99c6bf
Showing
1 changed file
with
32 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
node{ | ||
|
||
stage('SCM Checkout'){ | ||
git branch: 'master', | ||
credentialsId: 'javahometech', | ||
url: 'https://github.com/javahometech/myweb' | ||
} | ||
stage('Maven Build'){ | ||
def mvnHome = tool name: 'maven3', type: 'maven' | ||
sh "${mvnHome}/bin/mvn clean package" | ||
sh 'mv target/myweb*.war target/myweb.war' | ||
} | ||
stage('Build Docker Image'){ | ||
sh 'docker build -t kammana/myweb:5.0.0 .' | ||
} | ||
stage('Upload To DockerHub'){ | ||
|
||
sh "docker login -u kammana -p Cloud@1234" | ||
sh "docker push kammana/myweb:5.0.0" | ||
} | ||
|
||
stage('Deploy to Dev'){ | ||
sshagent(['tomcat-dev']) { | ||
def dockeRm = "ssh [email protected] docker rm -f myweb" | ||
def dockeRun = "ssh [email protected] docker run -d -p 80:8080 --name myweb kammana/myweb:5.0.0" | ||
sh "${dockeRm}" | ||
sh "${dockeRun}" | ||
} | ||
} | ||
|
||
} | ||
|