Skip to content

chore: 홈서버 셀프호스트 배포로 전환 (dev 트리거)#86

Merged
wlgusqkr merged 18 commits into
devfrom
chore/migrate-to-homeserver
May 17, 2026
Merged

chore: 홈서버 셀프호스트 배포로 전환 (dev 트리거)#86
wlgusqkr merged 18 commits into
devfrom
chore/migrate-to-homeserver

Conversation

@wlgusqkr
Copy link
Copy Markdown
Contributor

Summary

  • AWS EC2 SSH 기반 배포에서 맥미니 홈서버 셀프호스트 러너 기반 배포로 전환
  • Dockerfile 멀티스테이지화 (gradle:8.5-jdk17 -> eclipse-temurin:17-jre) — 호스트 사전 빌드 없이 docker compose build만으로 산출물 생성
  • 신규 deploy.yml: main 푸시 시 셀프호스트 러너에서 git reset --hard origin/maindocker compose buildup -d → caddy 경유 /actuator/health 스모크 테스트
  • 기존 cicd.yml 제거 (Docker Hub 푸시 + EC2 SSH 폐기)

홈서버 측 사전 작업 (완료)

  • 러너: gh-runner-todaysound (macmini-runner-todaysound, online)
  • DB: services/mysql (MySQL 8, main_db)
  • 앱 compose: services/todaysound (build: ./repo)
  • 라우팅: caddy/sites/todaysound.caddytoday-sound.com, www.today-sound.com
  • DNS: Cloudflare 이전 완료

Test plan

  • 머지 후 deploy.yml 자동 트리거
  • 셀프호스트 러너에서 docker compose build 성공
  • todaysound-server 컨테이너 기동 + Flyway V1~V4 적용
  • today-sound.com/actuator/health 200/401/403

🤖 Generated with Claude Code

DOHOON0127 and others added 15 commits October 31, 2025 17:52
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으로 합치기
- 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 이관 완료)
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread Dockerfile Outdated
COPY build/libs/*SNAPSHOT*.jar /app/app.jar
FROM gradle:8.5-jdk17 AS build
WORKDIR /src
COPY --chown=gradle:gradle . .
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

.dockerignore 파일이 프로젝트 루트에 존재하지 않는 것으로 보입니다. 이 경우 .git 디렉토리나 로컬 빌드 산출물(build/) 등 불필요한 파일들이 빌드 컨텍스트에 포함되어 이미지 크기가 커지고 빌드 성능이 저하될 수 있습니다. 필요한 파일만 명시적으로 복사하거나 .dockerignore 파일을 추가하여 관리하는 것을 권장합니다.

Comment thread Dockerfile Outdated
WORKDIR /src
COPY --chown=gradle:gradle . .
RUN --mount=type=cache,target=/home/gradle/.gradle \
gradle --no-daemon clean bootJar -x test -x asciidoctor
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

시스템에 설치된 gradle 명령어 대신 프로젝트에 포함된 Gradle Wrapper(./gradlew)를 사용하는 것이 좋습니다. 이는 로컬 개발 환경과 CI/CD 환경 간의 Gradle 버전을 일치시켜 빌드 일관성을 보장합니다. 또한, -x asciidoctor 옵션은 build.gradlebootJar 설정(112-115라인)과 충돌할 수 있습니다. bootJarasciidoctor 결과물을 포함하도록 구성되어 있으므로, 이 옵션을 사용하면 API 문서가 누락된 JAR 파일이 생성됩니다. 의도적으로 문서를 제외하려는 것이 아니라면 확인이 필요합니다.

    ./gradlew --no-daemon clean bootJar -x test -x asciidoctor

Comment thread Dockerfile

FROM eclipse-temurin:17-jre
WORKDIR /app
COPY --from=build /src/build/libs/*SNAPSHOT*.jar /app/app.jar
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

*SNAPSHOT*.jar 와일드카드는 프로젝트 버전이 SNAPSHOT이 아니게 변경될 경우(예: 정식 릴리스 시) 빌드 실패를 유발합니다. 유지보수성을 위해 *.jar와 같이 더 유연한 패턴을 사용하거나, build.gradle에서 archiveFileName을 고정하여 사용하는 것이 안전합니다. (단, *.jar 사용 시 빌드 결과물 디렉토리에 단일 JAR만 존재해야 합니다.)

COPY --from=build /src/build/libs/*.jar /app/app.jar

Comment thread Dockerfile
ENV SPRING_PROFILES_ACTIVE=prod
EXPOSE 8080

ENTRYPOINT ["java","-jar","/app/app.jar"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

보안상 애플리케이션을 root 사용자로 실행하는 것은 권장되지 않습니다. 컨테이너 내부에 비특권 사용자(non-root user)를 생성하고 USER 명령어를 사용하여 실행 권한을 제한함으로써, 잠재적인 보안 위협(컨테이너 탈출 등) 발생 시 피해 범위를 최소화할 수 있습니다.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 17, 2026

Test Results

24 tests   24 ✅  3s ⏱️
10 suites   0 💤
10 files     0 ❌

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
@wlgusqkr wlgusqkr changed the title chore: 홈서버 셀프호스트 배포로 전환 chore: 홈서버 셀프호스트 배포로 전환 (dev 트리거) May 17, 2026
@wlgusqkr wlgusqkr changed the base branch from main to dev May 17, 2026 12:18
지현 added 2 commits May 17, 2026 21:56
- 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로 대체되므로
충돌 해결도 삭제 방향으로 마무리.
@wlgusqkr wlgusqkr merged commit da9c362 into dev May 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants