Dockerfile update

This commit is contained in:
youbeen 2025-06-13 11:06:08 +09:00
parent 3dbedf3561
commit 8444db8c6c

View File

@ -1,4 +1,4 @@
# Analytics 서비스용 Dockerfile
# Recommend 서비스용 Dockerfile
FROM eclipse-temurin:21-jdk-alpine AS builder
# 작업 디렉토리 설정
@ -12,11 +12,11 @@ COPY settings.gradle .
# 소스 코드 복사
COPY common common/
COPY analytics analytics/
COPY recommend recommend/
# 실행 권한 부여 및 빌드
RUN chmod +x ./gradlew
RUN ./gradlew analytics:build -x test --no-daemon
RUN ./gradlew recommend:build -x test --no-daemon
# 실행 단계
FROM eclipse-temurin:21-jre-alpine
@ -29,7 +29,7 @@ RUN addgroup -g 1001 -S appgroup && \
WORKDIR /app
# 빌드된 JAR 파일 복사
COPY --from=builder /app/analytics/build/libs/analytics-*.jar app.jar
COPY --from=builder /app/recommend/build/libs/recommend-*.jar app.jar
# 파일 소유권 변경
RUN chown -R appuser:appgroup /app
@ -37,14 +37,14 @@ RUN chown -R appuser:appgroup /app
# 사용자 변경
USER appuser
# 포트 노출
EXPOSE 8080
# 포트 노출 (Recommend 서비스는 8085 포트)
EXPOSE 8085
# 헬스체크 추가
# 헬스체크 추가 (포트 8085로 변경)
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/actuator/health || exit 1
CMD wget --no-verbose --tries=1 --spider http://localhost:8085/actuator/health || exit 1
# JVM 옵션 설정
# JVM 옵션 설정 (추천 서비스는 더 많은 메모리 필요)
ENV JAVA_OPTS="-Xms512m -Xmx1024m -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:+UseStringDeduplication"
# 애플리케이션 실행