Skip to content

Commit 1ef8c11

Browse files
authored
Merge pull request #88 from Move-Log/develop
[HOTFIX] timezone 설정 및 정렬 수정
2 parents 70b6985 + 907681c commit 1ef8c11

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

Dockerfile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
FROM gradle:7.6-jdk17-alpine as builder
33
WORKDIR /build
44

5+
# Set TimeZone to Asia/Seoul for build stage
6+
RUN apk add --no-cache tzdata && \
7+
ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime && \
8+
echo "Asia/Seoul" > /etc/timezone
9+
510
# Copy Gradle settings
611
COPY build.gradle settings.gradle /build/
712

@@ -15,8 +20,20 @@ RUN gradle build -x test --parallel --info
1520
# Final runtime image
1621
FROM openjdk:17.0-slim
1722
WORKDIR /app
23+
24+
# Set TimeZone to Asia/Seoul for runtime stage
25+
RUN apt-get update && apt-get install -y tzdata && \
26+
ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime && \
27+
echo "Asia/Seoul" > /etc/timezone
28+
1829
COPY --from=builder /build/build/libs/*-SNAPSHOT.jar ./app.jar
30+
31+
# Ensure correct permissions
1932
RUN chown nobody:nogroup /app
2033
USER nobody
2134
EXPOSE 8080
22-
ENTRYPOINT ["java", "-jar", "/app/app.jar"]
35+
36+
# Set the default TimeZone for the JVM
37+
ENV TZ=Asia/Seoul
38+
ENTRYPOINT ["java", "-Duser.timezone=Asia/Seoul", "-jar", "/app/app.jar"]
39+

src/main/java/com/movelog/domain/news/domain/repository/NewsRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public interface NewsRepository extends JpaRepository<News, Long> {
1919
"JOIN n.keyword k " +
2020
"WHERE k.user = :user " +
2121
"AND n.createdAt > :createdAt " +
22-
"ORDER BY n.createdAt ASC")
22+
"ORDER BY n.createdAt DESC")
2323
Page<News> findRecentNewsByUser(
2424
@Param("user") User user,
2525
@Param("createdAt") LocalDateTime createdAt,

0 commit comments

Comments
 (0)