chore: 홈서버 셀프호스트 배포로 전환 (dev 트리거)#86
Conversation
[deploy] main에 머지
[deploy]#9 cicd파일 수정
Merge pull request #11 from Today-s-Sound/dev
[hotfix] cicd파일 수정
[hotfix] cicd파일 수정
[hotfix] cicd파일 수정
[hotfix] cicd파일 수정
[deploy] 배포 테스트
[hotfix] cicd파일 수정
[hotfix] securityconfig health check 추가
[hotfix] cicd파일 수정
[Feat] Main으로 합치기
dev to main
- Dockerfile 멀티스테이지화 (gradle:8.5-jdk17 -> eclipse-temurin:17-jre) 호스트에서 사전 빌드 없이 docker build만으로 산출물 생성 - deploy.yml 추가: 셀프호스트 러너(macmini-runner-todaysound)에서 git fetch -> docker compose build -> up -d -> caddy 경유 헬스체크 - cicd.yml 제거: EC2 SSH 기반 배포 종료 (AWS 이관 완료)
There was a problem hiding this comment.
Code Review
This pull request refactors the Dockerfile into a multi-stage build to optimize the image size and separate the build environment from the runtime. Feedback includes recommendations to add a .dockerignore file to reduce build context, use the Gradle Wrapper for consistent builds, and avoid excluding documentation tasks like asciidoctor. Additionally, security and maintenance improvements were suggested, such as running the application as a non-root user and using a more flexible JAR naming pattern to prevent build failures during release cycles.
| COPY build/libs/*SNAPSHOT*.jar /app/app.jar | ||
| FROM gradle:8.5-jdk17 AS build | ||
| WORKDIR /src | ||
| COPY --chown=gradle:gradle . . |
| WORKDIR /src | ||
| COPY --chown=gradle:gradle . . | ||
| RUN --mount=type=cache,target=/home/gradle/.gradle \ | ||
| gradle --no-daemon clean bootJar -x test -x asciidoctor |
There was a problem hiding this comment.
시스템에 설치된 gradle 명령어 대신 프로젝트에 포함된 Gradle Wrapper(./gradlew)를 사용하는 것이 좋습니다. 이는 로컬 개발 환경과 CI/CD 환경 간의 Gradle 버전을 일치시켜 빌드 일관성을 보장합니다. 또한, -x asciidoctor 옵션은 build.gradle의 bootJar 설정(112-115라인)과 충돌할 수 있습니다. bootJar가 asciidoctor 결과물을 포함하도록 구성되어 있으므로, 이 옵션을 사용하면 API 문서가 누락된 JAR 파일이 생성됩니다. 의도적으로 문서를 제외하려는 것이 아니라면 확인이 필요합니다.
./gradlew --no-daemon clean bootJar -x test -x asciidoctor
|
|
||
| FROM eclipse-temurin:17-jre | ||
| WORKDIR /app | ||
| COPY --from=build /src/build/libs/*SNAPSHOT*.jar /app/app.jar |
There was a problem hiding this comment.
| ENV SPRING_PROFILES_ACTIVE=prod | ||
| EXPOSE 8080 | ||
|
|
||
| ENTRYPOINT ["java","-jar","/app/app.jar"] |
Test Results24 tests 24 ✅ 3s ⏱️ Results for commit d32bbfd. ♻️ This comment has been updated with latest results. |
main은 운영에서 거의 사용하지 않으므로 dev 푸시 시점에 배포되도록 변경. - on.push.branches: main -> dev - 러너의 git reset --hard origin/main -> origin/dev
- FROM gradle:8.5-jdk17 -> eclipse-temurin:17-jdk + ./gradlew - gradle-wrapper.properties가 8.14.3을 지정하므로 wrapper를 따라야 로컬/CI 환경 버전이 일치 - -x test -x asciidoctor 옵션은 의도적으로 유지 (기존 cicd.yml과 동일, swagger-ui는 springdoc 어노테이션 기반이라 asciidoctor와 무관)
dev 쪽에서 cicd.yml이 수정됐지만 어차피 셀프호스트 deploy.yml로 대체되므로 충돌 해결도 삭제 방향으로 마무리.
Summary
gradle:8.5-jdk17->eclipse-temurin:17-jre) — 호스트 사전 빌드 없이docker compose build만으로 산출물 생성deploy.yml: main 푸시 시 셀프호스트 러너에서git reset --hard origin/main→docker compose build→up -d→ caddy 경유/actuator/health스모크 테스트cicd.yml제거 (Docker Hub 푸시 + EC2 SSH 폐기)홈서버 측 사전 작업 (완료)
gh-runner-todaysound(macmini-runner-todaysound, online)services/mysql(MySQL 8,main_db)services/todaysound(build: ./repo)caddy/sites/todaysound.caddy→today-sound.com,www.today-sound.comTest plan
deploy.yml자동 트리거docker compose build성공todaysound-server컨테이너 기동 + Flyway V1~V4 적용today-sound.com/actuator/health200/401/403🤖 Generated with Claude Code