-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (42 loc) · 1.65 KB
/
Dockerfile
File metadata and controls
53 lines (42 loc) · 1.65 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 1) Build Stage
FROM eclipse-temurin:17-jdk-jammy AS builder
WORKDIR /app
# Gradle Wrapper / settings / root build
COPY gradlew .
COPY gradle/ gradle/
COPY build.gradle settings.gradle ./
# (캐시 핵심) 멀티모듈의 build.gradle만 먼저 복사
COPY catchmate-common/build.gradle catchmate-common/
COPY catchmate-domain/build.gradle catchmate-domain/
COPY catchmate-infrastructure/build.gradle catchmate-infrastructure/
COPY catchmate-application/build.gradle catchmate-application/
COPY catchmate-orchestration/build.gradle catchmate-orchestration/
COPY catchmate-api/build.gradle catchmate-api/
COPY catchmate-authorization/build.gradle catchmate-authorization/
COPY catchmate-mcp/build.gradle catchmate-mcp/
COPY catchmate-boot/build.gradle catchmate-boot/
RUN chmod +x ./gradlew
# (캐시 활용) 전체 dependencies 대신, 실제 컨테이너 빌드 타깃 모듈만 의존성 해석
RUN ./gradlew :catchmate-boot:dependencies --no-daemon
# 소스 전체 복사 후 빌드
COPY . .
RUN ./gradlew :catchmate-boot:bootJar -x test --no-daemon
# 2) Run Stage
FROM eclipse-temurin:17-jre-jammy
WORKDIR /app
COPY --from=builder /app/catchmate-boot/build/libs/*.jar app.jar
RUN mkdir -p /app/logs
EXPOSE 8080
ENV JAVA_OPTS="\
-Xms512m \
-Xmx512m \
-XX:MaxMetaspaceSize=192m \
-Xss512k \
-XX:+UseG1GC \
-XX:MaxGCPauseMillis=200 \
-XX:G1HeapRegionSize=4m \
-XX:InitiatingHeapOccupancyPercent=45 \
-XX:+UseStringDeduplication \
-XX:+UseContainerSupport \
-Xlog:gc*:file=/app/logs/gc.log:time,uptime,level,tags:filecount=5,filesize=10m"
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar app.jar"]