Skip to content

chore: Dockerfile 시간대 설정 이중화 및 주석 정정 (#76) - #77

Merged
cowtree28 merged 1 commit into
developfrom
chore/76-dockerfile-timezone
Oct 6, 2026
Merged

cowtree28 merged 1 commit into
developfrom
chore/76-dockerfile-timezone

Conversation

@cowtree28

@cowtree28 cowtree28 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

개요

Dockerfile의 시간대 주석이 존재하지 않는 클래스를 가리키고 있었고, 운영 시간대가 ENV TZ 한 줄의 단일 실패점이었다. 주석을 사실에 맞게 고치고 -Duser.timezone으로 이중화한 뒤, 사라지면 CI가 잡도록 테스트를 넣었다.

Closes #76

변경 내용

1. 주석 정정 — TimeZoneConfig는 #59 작업 중 만들었다가 버그를 유발해 삭제한 클래스다. 코드에 없다. 주석이 "컨테이너 TZ는 보조 수단"처럼 읽혔는데 실제로는 그게 전부였다.

2. ENTRYPOINT에 -Duser.timezone=Asia/Seoul 추가 — 둘 중 하나만 남아도 동작한다.

3. ServerTimeZoneTest에 Dockerfile 검증 테스트 추가 — 두 줄 중 하나라도 사라지면 실패한다. 양쪽을 각각 지워 보고 실제로 FAILED가 되는 것까지 확인했다.

운영 베이스 이미지에서 실측

eclipse-temurin:21-jre / 21-jdk로 직접 확인했다.

조건 user.timezone TimeZone.getDefault() now()
아무것도 없음 null Etc/UTC 04:55
TZ=Asia/Seoul null Asia/Seoul 13:55
-Duser.timezone=Asia/Seoul만 Asia/Seoul Asia/Seoul 13:56
둘 다 Asia/Seoul Asia/Seoul 13:56

둘 다 설정해도 충돌하지 않는다.

빌드한 이미지로 검증

$ docker run --rm --entrypoint date commonly-tzcheck
Tue Oct  6 01:59:58 PM KST 2026

$ docker inspect --format '{{json .Config.Entrypoint}}'
["java","-Duser.timezone=Asia/Seoul","-jar","/app/app.jar"]

# TZ를 UTC로 강제해도 JVM 플래그가 받쳐준다
$ docker run --rm -e TZ=UTC ... java -Duser.timezone=Asia/Seoul -XshowSettings:properties
    user.timezone = Asia/Seoul

왜 TimeZone.setDefault()를 쓰지 않는지 (주석에도 남김)

setDefault()는 user.timezone 시스템 프로퍼티를 갱신하지 않는다. 그래서 JDBC는 UTC로, 애플리케이션은 KST로 동작하고 LocalDate가 DB 왕복에서 하루 밀린다. #59 작업 중 실측한 값이다.

user.timezone 프로퍼티 = UTC
TimeZone.getDefault()  = Asia/Seoul
Jackson 직렬화         = "1990-01-01"   (정상)
DB 왕복: 저장 1990-01-01 -> 조회 1989-12-31   (하루 밀림)

테스트

전체 120개 통과 (119 + 1).

서버 영향

없다. 설정값이 바뀌지 않고 같은 시간대를 두 경로로 거는 것뿐이다. 재배포만 하면 된다.

Summary by CodeRabbit

  • Bug Fixes
    • Applications launched in a container now use the Asia/Seoul timezone for Java date and time handling, helping keep application and database timestamps aligned.
  • Documentation
    • Clarified how the container timezone setting and Java timezone option relate to date handling.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 39a9eaf7-961a-4684-ae88-f5268d81c8bc
📥 Commits

Reviewing files that changed from the base of the PR and between 5b1238d and 5c2856a.

📒 Files selected for processing (2)
  • Dockerfile
  • src/test/java/commonly/commonlybe/global/config/ServerTimeZoneTest.java
 ______________________________________________________
< Linters are opinions; I'm the peer-reviewed journal. >
 ------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cowtree28
cowtree28 merged commit ca55da6 into develop Oct 6, 2026
1 of 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.

Dockerfile 시간대 주석이 틀렸고 설정이 단일 실패점이다

1 participant