[#96] Refactor: 배포 성능 개선 #127
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔍 관련 이슈
#96
💡 주요 변경사항
수동 배포 시의 빌드 시간이 길어지는 문제를 해결하고자 생성한 이슈인데, 이후에 CI/CD까지 구현되어 전체 배포 프로세스를 고려하여 수정하였습니다.
특히 '의존성 캐싱'에 중점을 두어, CI/CD 파이프라인의 Build(CI) 단계에서 이전 빌드에서 캐시된 의존성을 재사용하도록 설정했습니다.
또한, 배포용 Dockerfile을 멀티 스테이지 빌드와 의존성 캐싱을 적용해 빌드 속도를 개선하고자 하였습니다.
🎯 테스트 방법
X
🚨 논의하고 싶은 점
실제로 유의미한 결과가 있을지는 잘 모르겠습니다...
효과가 미비하면 추후에 2차 리팩토링해보겠습니다...
🚨🚨 추가 변경사항
해당 내용은 PR 사항이라기보다 개인적 기록용으로 작성합니다!
의존성 캐싱 도입한 내용 배제하고 지금까지의 CI/CD 관련 내용 정리합니다.
basic_deploy.yml.disabled
V1 : CI 단계에서 간단 jar build(컴파일 체크용) + CD 단계에서 jar build & 도커 이미지 build

컴파일 체크용이지만, build를 2번하는 것이 개인적으로 비효율적이라고 생각하였습니다.
jar_deploy.yml.disabled
V2 : CI 단계에서 jar build + CD 단계에서 CI 단계의 jar파일을 EC2로 전송 & 도커 이미지 build

jar build는 1번으로 줄어들었지만, jar파일을 EC2로 전송하는 시간이 너무 오래 걸려서 되려 CI/CD 총 소요시간이 20분까지 걸리는 문제가 발생하였습니다. (V1보다 되려 악화되어서 바로 폐기)
docker_hub_deploy.yml
V3: CI단계에서 jar build & 도커 이미지 build & Docker Hub로 업로드 + CD단계의 EC2에서 Docker Hub의 이미지를 다운로드

V2의 실패로 인하여 방법을 더 찾던 과정에서 Docker Hub를 알게 되었고, 현재 적용한 상태입니다.