diff --git a/Dockerfile b/Dockerfile index 81c34ef..c4cfa30 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,16 @@ FROM openjdk:17 ARG JAR_FILE=build/libs/*.jar + +# 로그 디렉토리 생성 +RUN mkdir /logs + +# 애플리케이션 JAR 파일 복사 COPY ${JAR_FILE} app.jar + +# 로그 디렉토리에 대한 권한 설정 +RUN chmod 777 /logs + ENTRYPOINT ["java","-jar","app.jar","--spring.profiles.active=prod","-Duser.timezone=Asia/Seoul"] + +# 볼륨 설정 +VOLUME ["/logs"] diff --git a/build.gradle b/build.gradle index a8aaa06..e7b9bc6 100644 --- a/build.gradle +++ b/build.gradle @@ -64,7 +64,7 @@ dependencies { implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' /* Logback JSON */ - implementation 'net.logstash.logback:logstash-logback-encoder:6.1' + implementation 'net.logstash.logback:logstash-logback-encoder:8.0' compileOnly 'ch.qos.logback.contrib:logback-jackson:0.1.5' compileOnly 'ch.qos.logback.contrib:logback-json-classic:0.1.5' diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index c06c9d1..01bf524 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -1,7 +1,7 @@ - - + + @@ -9,29 +9,31 @@ - - - - - - - - - - - - - + + /logs/application.log + + correlationId + {"app_name":"colla-backend","environment":"prod"} + + + /logs/application.%d{yyyy-MM-dd}.%i.log + + 500MB + + 30 + 10GB + + - + - - + +