This commit is contained in:
97
Jenkinsfile
vendored
Normal file
97
Jenkinsfile
vendored
Normal file
@@ -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...'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user