forked from javahometech/my-app
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Sep 6, 2022
1 parent
f6efc59
commit 141c6b4
Showing
1 changed file
with
38 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,38 @@ | ||
pipeline{ | ||
agent any | ||
stages{ | ||
stage("Git Checkout"){ | ||
steps{ | ||
git url:"https://github.com/javahometech/my-app" | ||
} | ||
} | ||
stage("Maven Package"){ | ||
steps{ | ||
sh "mvn clean package" | ||
} | ||
} | ||
stage("Docker Build"){ | ||
steps{ | ||
sh "docker build -t kammana/hariapp:${env.BUILD_NUMBER} ." | ||
} | ||
} | ||
stage("DockerHub Push"){ | ||
steps{ | ||
withCredentials([usernamePassword(credentialsId: 'dockerhub', passwordVariable: 'pwd', usernameVariable: 'user')]) { | ||
sh "docker login -u ${user} -p ${pwd}" | ||
sh "docker push kammana/hariapp:${env.BUILD_NUMBER}" | ||
} | ||
|
||
} | ||
} | ||
stage("Docker Deploy Dev"){ | ||
steps{ | ||
sshagent(['docker-dev-ssh']) { | ||
sh "ssh -o StrictHostKeyChecking=no [email protected] docker rm -f hariapp" | ||
sh "ssh [email protected] docker run -d -p 8080:8080 --name hariapp kammana/hariapp:${env.BUILD_NUMBER}" | ||
} | ||
|
||
} | ||
} | ||
} | ||
} |