From 71bcbbb396445eaffbe92e0d1eb1c19a8f669b2a Mon Sep 17 00:00:00 2001 From: leejisun9 Date: Tue, 26 Aug 2025 13:21:15 +0900 Subject: [PATCH] =?UTF-8?q?JIB=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20,=20skaffold,k8s=20=EB=B0=B0=ED=8F=AC=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 35 +++++++++++++++++++++++++++++++++++ k8s/deployment.yaml | 21 --------------------- skaffold.yaml | 12 ------------ 3 files changed, 35 insertions(+), 33 deletions(-) delete mode 100644 k8s/deployment.yaml delete mode 100644 skaffold.yaml diff --git a/build.gradle b/build.gradle index f3ad22e..303e893 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ plugins { id 'java' id 'org.springframework.boot' version '3.5.4' id 'io.spring.dependency-management' version '1.1.7' + id 'com.google.cloud.tools.jib' version '3.4.0' // Jib 플러그인 추가 } group = 'com.bio' @@ -80,4 +81,38 @@ clean { } tasks.withType(JavaCompile).configureEach { options.generatedSourceOutputDirectory = file(generatedSrcDir) +} + +jib { + from { + image = 'demo.stam.kr/leejisun9/eclipse-temurin:17-jre' // 가벼운 JRE 베이스 + // (선택) 인증서 추가/회사 CA 필요 시 extraDirectories 사용 + } + to { + image = 'demo.stam.kr/leejisun9/bio-backend'; tags = ['1.0.0'] // 기본 대상 레지스트리 + // tags는 skaffold가 자동 주입. 로컬 단독 빌드시 -Djib.to.tags=로 지정 가능 + } + container { + // Spring Boot 컨테이너 런타임 옵션 + ports = ['8080'] + jvmFlags = [ + '-XX:+UseContainerSupport', + '-Dserver.port=8080', + '-XX:InitialRAMPercentage=50.0', + '-XX:MaxRAMPercentage=75.0' + ] + environment = [ 'SPRING_PROFILES_ACTIVE': 'dev' ] + // (선택) non-root 권장 (권한 필요한 리소스 없는 경우) + // user = '65532:65532' + // workingDirectory = '/app' + } + // (선택) 계층 최적화/추가 파일 + // extraDirectories { + // paths { + // path { + // from = file('docker/extra') // 예: CA cert, 설정 템플릿 + // into = '/opt/extra' + // } + // } + // } } \ No newline at end of file diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml deleted file mode 100644 index e531ac8..0000000 --- a/k8s/deployment.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: bio-backend-deployment - labels: - app: bio-backend -spec: - replicas: 1 - selector: - matchLabels: - app: bio-backend - template: - metadata: - labels: - app: bio-backend - spec: - containers: - - name: bio-backend - image: backend-0.0.1:latest # 여기에 Skaffold가 빌드할 이미지 이름을 사용합니다. - ports: - - containerPort: 8081 \ No newline at end of file diff --git a/skaffold.yaml b/skaffold.yaml deleted file mode 100644 index a027dfc..0000000 --- a/skaffold.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: skaffold/v4beta13 -kind: Config -metadata: - name: bio-backend -build: - artifacts: - - image: backend-0.0.1 - docker: - dockerfile: Dockerfile -manifests: - rawYaml: - - k8s/deployment.yaml