From d55499f97660698f4065489e12dad14bb7dc27a9 Mon Sep 17 00:00:00 2001 From: mindol1004 Date: Tue, 26 Dec 2023 14:57:59 +0900 Subject: [PATCH] commit --- Jenkinsfile | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..6d0390f --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,97 @@ +pipeline { + agent any + + tools { + jdk 'jdk17' + } + + environment { + imagename = "mindol1004/kiz" + registryCredential = 'docker' + dockerImage = '' + } + + stages { + // repository clone + stage('Repository clone') { + steps { + script { + // 새로운 클론 + echo 'Cloning Repository' + git url: 'http://mindol.synology.me:8418/kiz-cloud/kiz-shop.git', + branch: 'main', + credentialsId: 'Gitea' + } + } + post { + success { + echo 'Successfully Cloned Repository' + } + failure { + error 'This pipeline stops here...' + } + } + } + + // gradle build + stage('Bulid Gradle') { + agent any + steps { + echo 'Bulid Gradle' + dir ('/var/jenkins_home/workspace/kiz-shop'){ + sh './gradlew clean build' + } + } + post { + success { + echo 'Successfully Bulid Gradle' + } + failure { + error 'This pipeline stops here...' + } + } + } + + // docker build + stage('Bulid Docker') { + agent any + steps { + echo 'Bulid Docker' + script { + dir ('/var/jenkins_home/workspace/kiz-shop'){ + dockerImage = docker.build imagename + } + } + } + post { + success { + echo 'Successfully Bulid Docker' + } + failure { + error 'This pipeline stops here...' + } + } + } + + // docker push + stage('Push Docker') { + agent any + steps { + echo 'Push Docker' + script { + docker.withRegistry('', registryCredential){ + dockerImage.push("1.0") + } + } + } + post { + success { + echo 'Successfully Push Docker' + } + failure { + error 'This pipeline stops here...' + } + } + } + } +} \ No newline at end of file