Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor] #256 - Jenkinsfile의 sshPut 명령어 삭제 및 deploy 스크립트 자체에서 dangling 이미지를 삭제하도록 변경 완료 #302

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ pipeline {
// Docker 이미지 pull
sshCommand remote: remote, command: "docker pull ${DOCKER_HUB_ID}/${PROJECT_NAME}-${OPERATION_ENV}:latest"

// Jenkins 서버에서 원격 서버로 파일 복사
sshPut remote: remote, from: "/home/ubuntu/deployment/deploy-${OPERATION_ENV}.sh", into: "/home/ubuntu/deployment"
sshPut remote: remote, from: '/home/ubuntu/nginx.conf', into: '/home/ubuntu'

// 환경변수를 넘기고 deploy-${OPERATION_ENV}.sh 실행
sshCommand remote: remote, command: """
export OPERATION_ENV=${OPERATION_ENV} && \
Expand All @@ -96,24 +92,6 @@ pipeline {
chmod +x deploy-${OPERATION_ENV}.sh && \
./deploy-${OPERATION_ENV}.sh
"""
//
// // 기존 컨테이너 제거
// sshCommand remote: remote, failOnError: false, command: 'docker rm -f springboot'
//
// // 새로운 컨테이너 실행
// sshCommand remote: remote, command: (
// 'docker run -d --name springboot' +
// ' --network beat-network' +
// ' -p 8080:' + INTERNAL_PORT +
// ' -e "SPRING_PROFILES_ACTIVE=' + OPERATION_ENV + '"' +
// ' ' + dockerImage
// )

// Docker dangling 이미지 정리
sshCommand remote: remote, command: '''
docker images -f "dangling=true" -q | \
xargs -r docker rmi
'''
}
}
}
Expand Down