From ac89590227b4633cfbe73f6e9a5fc6a2c5cd522d Mon Sep 17 00:00:00 2001 From: Nana Janashia Date: Fri, 1 Jan 2021 17:08:02 +0000 Subject: [PATCH] Add new file --- Jenkinsfile-simple-pipeline/script.groovy | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Jenkinsfile-simple-pipeline/script.groovy diff --git a/Jenkinsfile-simple-pipeline/script.groovy b/Jenkinsfile-simple-pipeline/script.groovy new file mode 100644 index 0000000..0a70eb5 --- /dev/null +++ b/Jenkinsfile-simple-pipeline/script.groovy @@ -0,0 +1,19 @@ +def buildJar() { + echo "building the application..." + sh 'mvn package' +} + +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 'deploying the application...' +} + +return this