From 054a2669314fc8c99e8e931a56bb050b5c903af9 Mon Sep 17 00:00:00 2001 From: pooreumjung Date: Mon, 22 Jun 2026 21:34:23 +0900 Subject: [PATCH 1/3] =?UTF-8?q?refactor:=20Docker=20=EC=A4=91=EB=B3=B5=20?= =?UTF-8?q?=EB=B9=8C=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 13 +++++++++++-- .github/workflows/deploy.yml | 5 ++++- Dockerfile | 21 ++------------------- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/.dockerignore b/.dockerignore index 8c2ff6b5..963416b1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,14 @@ .git .gitignore *.md -build/ -src/test/ \ No newline at end of file +src/test/ +.gradle/ +.idea/ +.DS_Store +*/.DS_Store +.env +src/main/resources/application-local.yml + +build/* +!build/libs/ +!build/libs/*.jar diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 18704696..c61d2ef9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -49,7 +49,10 @@ jobs: run: chmod +x gradlew - name: Gradle로 빌드 - run: ./gradlew clean build -x test + run: ./gradlew build -x test --no-daemon + + - name: 빌드 산출물 확인 + run: ls -lh build/libs/*.jar - name: Docker Hub 로그인 uses: docker/login-action@v2 diff --git a/Dockerfile b/Dockerfile index 800c1fe0..2118eece 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,8 @@ -# 1단계: 빌드 단계 (Gradle Wrapper를 사용하여 애플리케이션 빌드) -FROM --platform=linux/amd64 gradle:7.5.1-jdk17 AS builder -WORKDIR /home/gradle/project - -# 소스 코드 전체를 복사 (gradlew, build.gradle, settings.gradle, src/ 등) -COPY --chown=gradle:gradle . . - -# Gradle Wrapper 실행 권한 부여 (실행 권한이 없을 경우를 대비) -RUN chmod +x gradlew - -# Gradle을 사용하여 프로젝트 빌드 (JAR 파일은 build/libs 폴더에 생성됨) -RUN ./gradlew clean build --no-daemon - -# 2단계: 실행 단계 (빌드 결과물 실행을 위한 환경) -FROM --platform=linux/amd64 eclipse-temurin:17-jdk-alpine +FROM --platform=linux/amd64 eclipse-temurin:17-jre-alpine WORKDIR /app -# 빌드 단계에서 생성된 JAR 파일 복사 (파일명이 프로젝트에 따라 달라질 수 있으므로 와일드카드 사용) -COPY --from=builder /home/gradle/project/build/libs/*.jar app.jar +COPY build/libs/eat-ssu.jar app.jar -# 컨테이너에서 사용할 포트 (필요 시 변경) EXPOSE 9000 -# 애플리케이션 실행 ENTRYPOINT ["java", "-jar", "app.jar"] From 953d42cfe92d730f79397bc8df9e6db3b3c06957 Mon Sep 17 00:00:00 2001 From: pooreumjung Date: Mon, 22 Jun 2026 21:38:53 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20plain=20JAR=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=EC=96=B5=EC=A0=9C=20=EB=B0=8F=20Docker=20=EB=B9=8C=EB=93=9C=20?= =?UTF-8?q?=EC=84=A0=ED=96=89=20=EC=A1=B0=EA=B1=B4=20=EB=AC=B8=EC=84=9C?= =?UTF-8?q?=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- CLAUDE.md | 2 +- build.gradle | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index b06eaa2f..b898f9fc 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -35,7 +35,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ./gradlew test # 테스트만 실행 ./gradlew test --tests "ssu.eatssu.domain.review.service.ReviewServiceTest" # 단일 테스트 클래스 실행 ./gradlew bootRun --args='--spring.profiles.active=local' # 로컬 서버 실행 (port 9000) -docker build -f Dockerfile -t eatssu-local . # Docker 이미지 빌드 +docker build -f Dockerfile -t eatssu-local . # Docker 이미지 빌드 (반드시 ./gradlew build -x test 선행 필요) ``` 로컬 실행 시 MySQL이 `localhost:3306/eatssu`에 필요하며, `application-local.yml`에서 DB 정보를 설정한다. `.env` 파일로 환경변수를 오버라이드할 수 있다 (`spring.config.import: optional:file:.env[.properties]`). diff --git a/build.gradle b/build.gradle index 5d8312ed..068b8cb8 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,10 @@ bootJar { archiveVersion = "0.0.1" } +jar { + enabled = false +} + configurations { compileOnly { extendsFrom annotationProcessor From af79cd8d2cd0cbf1a3953ee7791bd929fc8996ce Mon Sep 17 00:00:00 2001 From: pooreumjung Date: Mon, 22 Jun 2026 21:49:03 +0900 Subject: [PATCH 3/3] =?UTF-8?q?refactor:=20Docker=20=EB=B9=8C=EB=93=9C=20?= =?UTF-8?q?=EC=BB=A8=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.dockerignore b/.dockerignore index 963416b1..c6718ac2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,14 +1,13 @@ .git .gitignore *.md -src/test/ +src/ .gradle/ .idea/ .DS_Store */.DS_Store .env -src/main/resources/application-local.yml build/* !build/libs/ -!build/libs/*.jar +!build/libs/eat-ssu.jar