-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (29 loc) · 1.01 KB
/
Dockerfile
File metadata and controls
39 lines (29 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Use Gradle with JDK 17 for build stage
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/
# Debug Gradle file setup
RUN ls -l /build && cat /build/build.gradle
# Build application
COPY . /build
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
# Set the default TimeZone for the JVM
ENV TZ=Asia/Seoul
ENTRYPOINT ["java", "-Duser.timezone=Asia/Seoul", "-jar", "/app/app.jar"]