diff --git a/script.groovy b/script.groovy index 8394048..79ddb88 100644 --- a/script.groovy +++ b/script.groovy @@ -1,14 +1,19 @@ -def buildApp() { - echo 'building the application...' +def buildJar() { + echo "building the application..." + sh 'mvn package' } -def testApp() { - echo 'testing the application...' +def buildImage() { + 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' + } } def deployApp() { - echo 'deplying the application...' - echo "deploying version ${params.VERSION}" + echo 'deploying the application...' } return this \ No newline at end of file