Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
FROM gradle:7.6-jdk17-alpine as builder
WORKDIR /build

# Set TimeZone to Asia/Seoul for build stage
RUN apk add --no-cache tzdata && \
ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime && \
echo "Asia/Seoul" > /etc/timezone

# Copy Gradle settings
COPY build.gradle settings.gradle /build/

Expand All @@ -15,8 +20,20 @@ RUN gradle build -x test --parallel --info
# Final runtime image
FROM openjdk:17.0-slim
WORKDIR /app

# Set TimeZone to Asia/Seoul for runtime stage
RUN apt-get update && apt-get install -y tzdata && \
ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime && \
echo "Asia/Seoul" > /etc/timezone

COPY --from=builder /build/build/libs/*-SNAPSHOT.jar ./app.jar

# Ensure correct permissions
RUN chown nobody:nogroup /app
USER nobody
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app/app.jar"]

# Set the default TimeZone for the JVM
ENV TZ=Asia/Seoul
ENTRYPOINT ["java", "-Duser.timezone=Asia/Seoul", "-jar", "/app/app.jar"]

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public interface NewsRepository extends JpaRepository<News, Long> {
"JOIN n.keyword k " +
"WHERE k.user = :user " +
"AND n.createdAt > :createdAt " +
"ORDER BY n.createdAt ASC")
"ORDER BY n.createdAt DESC")
Page<News> findRecentNewsByUser(
@Param("user") User user,
@Param("createdAt") LocalDateTime createdAt,
Expand Down