-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
235 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# 첫 번째 스테이지: 빌드 스테이지 | ||
FROM gradle:jdk21-graal-jammy as builder | ||
|
||
# 작업 디렉토리 설정 | ||
WORKDIR /app | ||
|
||
# 소스 코드와 Gradle 래퍼 복사 | ||
COPY gradlew . | ||
COPY gradle gradle | ||
COPY build.gradle . | ||
COPY settings.gradle . | ||
|
||
# Gradle 래퍼에 실행 권한 부여 | ||
RUN chmod +x ./gradlew | ||
|
||
# 종속성 설치 | ||
RUN ./gradlew dependencies --no-daemon | ||
|
||
# 소스 코드 복사 | ||
COPY src src | ||
|
||
# 애플리케이션 빌드 | ||
RUN ./gradlew build --no-daemon | ||
|
||
# 두 번째 스테이지: 실행 스테이지 | ||
FROM ghcr.io/graalvm/jdk-community:21 | ||
|
||
# 작업 디렉토리 설정 | ||
WORKDIR /app | ||
|
||
# 첫 번째 스테이지에서 빌드된 JAR 파일 복사 | ||
COPY --from=builder /app/build/libs/*.jar app.jar | ||
|
||
# 실행할 JAR 파일 지정 | ||
ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=prod", "app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/ll/k8s/domain/home/home/HomeController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.ll.k8s.domain.home.home; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
|
||
@Controller | ||
public class HomeController { | ||
@Value("${custom.jwt.secretKey}") | ||
private String jwtSecretKey; | ||
@GetMapping("/") | ||
@ResponseBody | ||
public String showMain() { | ||
return "홈8"; | ||
} | ||
@GetMapping("/jwtSecretKey") | ||
@ResponseBody | ||
public String showJwtSecretKey() { | ||
return jwtSecretKey; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.ll.k8s.global.app; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Configuration; | ||
@Configuration | ||
@RequiredArgsConstructor | ||
public class AppConfig { | ||
private static String activeProfile; | ||
@Value("${spring.profiles.active}") | ||
public void setActiveProfile(String activeProfile) { | ||
this.activeProfile = activeProfile; | ||
} | ||
public static boolean isProd() { | ||
return activeProfile.equals("prod"); | ||
} | ||
public static boolean isDev() { | ||
return activeProfile.equals("dev"); | ||
} | ||
public static boolean isTest() { | ||
return activeProfile.equals("Test"); | ||
} | ||
public static boolean isNotProd() { | ||
return !isProd(); | ||
} | ||
@Getter | ||
private static String jwtSecretKey; | ||
@Value("${custom.jwt.secretKey}") | ||
public void setJwtSecretKey(String jwtSecretKey) { | ||
this.jwtSecretKey = jwtSecretKey; | ||
} | ||
@Getter | ||
public static String tempDirPath; | ||
@Value("${custom.temp.dirPath}") | ||
public void setTempDirPath(String tempDirPath) { | ||
this.tempDirPath = tempDirPath; | ||
} | ||
@Getter | ||
public static String genDirPath; | ||
@Value("${custom.gen.dirPath}") | ||
public void setGenDirPath(String genDirPath) { | ||
this.genDirPath = genDirPath; | ||
} | ||
} | ||
|
15 changes: 15 additions & 0 deletions
15
src/main/java/com/ll/k8s/global/webMvcConfig/WebMvcConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.ll.k8s.global.webMvcConfig; | ||
|
||
import com.ll.k8s.global.app.AppConfig; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
@Configuration | ||
public class WebMvcConfig implements WebMvcConfigurer { | ||
@Override | ||
public void addResourceHandlers(ResourceHandlerRegistry registry) { | ||
registry.addResourceHandler("/gen/**") | ||
.addResourceLocations("file:///" + AppConfig.getGenDirPath() + "/"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
server: | ||
port: 8080 | ||
# 스프링부트가 종료 요청을 받았을 때 현재 본인이 하던 일(요청에 대한 응답, 배치작업 등)을 전부 마친 후 종료되도록 | ||
shutdown: graceful | ||
spring: | ||
autoconfigure: | ||
exclude: | ||
lifecycle: | ||
# 스프링부트가 종료 요청을 받은 후 기다려줄 수 있는 최대한의 시간 | ||
timeout-per-shutdown-phase: 1h | ||
data: | ||
redis: | ||
host: redis-1-service | ||
port: 6379 | ||
datasource: | ||
url: jdbc:mysql://mysql-1-service:3306/k8s_prod | ||
username: llddlocal | ||
password: 1234 | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
jpa: | ||
hibernate: | ||
ddl-auto: update | ||
properties: | ||
hibernate: | ||
format_sql: false | ||
highlight_sql: false | ||
use_sql_comments: false | ||
logging: | ||
level: | ||
com.ll.k8s: INFO | ||
org.hibernate.SQL: INFO | ||
org.hibernate.orm.jdbc.bind: INFO | ||
org.hibernate.orm.jdbc.extract: INFO | ||
org.springframework.transaction.interceptor: INFO | ||
custom: | ||
temp: | ||
dirPath: /tmp | ||
gen: | ||
dirPath: /gen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
custom: | ||
jwt: | ||
secretKey: NEED_TO_INPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
spring: | ||
datasource: | ||
url: jdbc:h2:mem:test;MODE=MYSQL | ||
username: sa | ||
password: | ||
driver-class-name: org.h2.Driver | ||
custom: | ||
gen: | ||
dirPath: /usr/temp/gen |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
server: | ||
port: 8090 | ||
spring: | ||
profiles: | ||
active: dev | ||
include: secret | ||
autoconfigure: | ||
exclude: | ||
- org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration | ||
- org.springframework.boot.autoconfigure.session.SessionAutoConfiguration | ||
servlet: | ||
multipart: | ||
max-file-size: 50MB | ||
max-request-size: ${spring.servlet.multipart.max-file-size} | ||
threads: | ||
virtual: | ||
enabled: true | ||
datasource: | ||
url: jdbc:h2:./db;MODE=MYSQL | ||
username: sa | ||
password: | ||
driver-class-name: org.h2.Driver | ||
security: | ||
user: | ||
name: user1 | ||
password: 1234 | ||
jpa: | ||
hibernate: | ||
ddl-auto: update | ||
properties: | ||
hibernate: | ||
default_batch_fetch_size: 100 | ||
format_sql: true | ||
highlight_sql: true | ||
use_sql_comments: true | ||
logging: | ||
level: | ||
com.ll.k8s: DEBUG # ?? ??? ?? ?? | ||
org.hibernate.SQL: DEBUG | ||
org.hibernate.orm.jdbc.bind: TRACE | ||
org.hibernate.orm.jdbc.extract: TRACE | ||
org.springframework.transaction.interceptor: TRACE | ||
custom: | ||
temp: | ||
dirPath: usr/temp | ||
gen: | ||
dirPath: usr/temp/gen |