forked from codesquad-members-2024/issue-tracker
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update deploy.yml Update Jenkinsfile Update Jenkinsfile Update Jenkinsfile Update Jenkinsfile Update deploy.yml Update Dockerfile
- Loading branch information
Showing
3 changed files
with
57 additions
and
4 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
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 { | ||
agent any | ||
|
||
environment { | ||
DOCKERHUB_CREDENTIALS = credentials('docker-hub-credentials') | ||
DOCKER_IMAGE = 'miensoap/issue-tracker' | ||
} | ||
|
||
stages { | ||
|
||
stage('github-clone') { | ||
steps { | ||
git branch: 'Deploy', | ||
credentialsId: 'github-token', | ||
url: 'https://github.com/codesquad-masters2024-team01/issue-tracker' | ||
} | ||
} | ||
|
||
stage('build-docker-image') { | ||
steps { | ||
script { | ||
dir('be/issue_tracker') { | ||
// Bash 사용하여 Docker 이미지 빌드 | ||
sh 'docker build -t ${DOCKER_IMAGE}:${BUILD_ID} . ' | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('docker-login') { | ||
steps { | ||
script { | ||
// Docker Hub 로그인 | ||
sh "echo ${DOCKERHUB_CREDENTIALS_PSW} | docker login -u ${DOCKERHUB_CREDENTIALS_USR} --password-stdin" | ||
} | ||
} | ||
} | ||
|
||
stage('push-docker-image') { | ||
steps { | ||
script { | ||
// Docker 이미지 푸시 | ||
sh 'docker push ${DOCKER_IMAGE}:${env.BUILD_ID}' | ||
} | ||
} | ||
} | ||
} | ||
|
||
post { | ||
always { | ||
// Clean up Docker images after the build | ||
sh 'docker rmi ${DOCKER_IMAGE}:${env.BUILD_ID}' | ||
} | ||
} | ||
} |
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