-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: jenkinsfile 작성 * chore: Clean up docker image 삭제
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 '오류가 발생했습니다.' | ||
} | ||
|
||
} | ||
} |