-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (28 loc) ยท 1.01 KB
/
Dockerfile
File metadata and controls
38 lines (28 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
# ========================================
# Stage 1: Build
# ========================================
FROM eclipse-temurin:21-jdk AS builder
WORKDIR /app
# Gradle wrapper ๋ฐ ๋น๋ ํ์ผ ๋ณต์ฌ
COPY gradlew build.gradle settings.gradle ./
COPY gradle gradle
# Gradle ์คํ ๊ถํ ๋ถ์ฌ ๋ฐ ์์กด์ฑ ์บ์
RUN chmod +x gradlew && ./gradlew dependencies --no-daemon
# ์์ค ์ฝ๋ ๋ณต์ฌ ๋ฐ ๋น๋ (ํ
์คํธ ์คํต)
COPY src src
RUN ./gradlew build -x test --no-daemon
# ========================================
# Stage 2: Runtime
# ========================================
FROM eclipse-temurin:21-jre
WORKDIR /app
# JAR ํ์ผ ๋ณต์ฌ (โ ๏ธ plain.jar ์ ์ธ)
ARG JAR_FILE=build/libs/*.jar
COPY --from=builder /app/${JAR_FILE} app.jar
# ํฌํธ ๋
ธ์ถ
EXPOSE 8080
# Health check (wget ์ฌ์ฉ - jre ์ด๋ฏธ์ง์ ํฌํจ)
HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=3 \
CMD wget --spider -q http://localhost:8080/api/actuator/health || exit 1
# ์คํ
ENTRYPOINT ["java", "-jar", "app.jar"]