Update Jenkinsfile

This commit is contained in:
Nana Janashia
2020-11-06 11:26:28 +00:00
parent 845783dbc6
commit e637047b84

21
Jenkinsfile vendored
View File

@@ -1,33 +1,36 @@
def gv
pipeline {
agent any
tools {
maven 'Maven'
}
stages {
stage("init") {
steps {
script {
gv = load "script.groovy"
}
}
}
stage("build jar") {
steps {
script {
echo "building the application..."
sh 'mvn package'
gv.buildJar()
}
}
}
stage("build image") {
steps {
script {
echo "building the docker image..."
withCredentials([usernamePassword(credentialsId: 'docker-hub-repo', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
sh 'docker build -t nanajanashia/demo-app:jma-2.0 .'
sh "echo $PASS | docker login -u $USER --password-stdin"
sh 'docker push nanajanashia/demo-app:jma-2.0'
}
gv.buildImage()
}
}
}
stage("deploy") {
steps {
script {
echo "deploying the application..."
gv.deployApp()
}
}
}