Skip to content

Commit

Permalink
Feature/infra GitHub (#201)
Browse files Browse the repository at this point in the history
* chore: jenkinsfile 작성

* chore: Clean up docker image 삭제
  • Loading branch information
kimJH47 authored May 5, 2024
1 parent 1246eaa commit ac7f9e1
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions scripts/cd_dev_jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
pipeline {
environment {
DOCKER_HUB_ID = credentials('DOCKER_HUB_ID')
}
agent any

tools {
gradle 'gradle'
}
stages {
stage('GitHub') {
steps {
checkout scmGit(
branches: [[name: 'dev']],
extensions: [submodule(parentCredentials: true, trackingSubmodules: true)],
userRemoteConfigs: [[credentialsId: 'git-account', url: 'https://github.com/Sal-Mal/salmal-be']]
)
}
}
stage('Build Gradle') {
steps {
sh "./gradlew clean bootJar"
}
}
stage('Build Docker Image') {
steps {
script {
dir('docker/') {
docker.build('tray1147/salmal')
}
}
}
}

stage('Push Docker Image to Docker Hub') {
steps {
script {
docker.withRegistry('https://index.docker.io/v1/', DOCKER_HUB_ID) {
docker.image('tray117/salmal').push('latest')
docker.image('tray117/salmal').push('${BUILD_NUMBER}')
}
}
}
}
}
post {
success {
echo '성공적으로 살말서버 도커 이미지가 도커허브로 푸시되었습니다.'
}
failure {
echo '오류가 발생했습니다.'
}

}
}

0 comments on commit ac7f9e1

Please sign in to comment.