diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index addead17..7a3d58b1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,8 +4,12 @@ name: Backend CI/CD using GitHub Actions & Docker on: push: branches: [ "main" ] + paths: + - 'backend/**' pull_request: branches: [ "main" ] + paths: + - 'backend/**' jobs: build: @@ -70,4 +74,4 @@ jobs: sudo docker run -d -p 8080:8080 ${{ secrets.DOCKER_USERNAME }}/backend:latest # 사용하지 않는 이미지 정리 - sudo docker image prune -a -f + sudo docker image prune -a -f \ No newline at end of file diff --git a/backend/Dockerfile b/backend/Dockerfile index c4f98352..073b8671 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,30 +1,5 @@ -# OpenJDK 기반 이미지 설정 -FROM bellsoft/liberica-openjdk-alpine:21 - -# dos2unix 설치 및 bash 설치 -RUN apk add --no-cache bash dos2unix - -# 작업 디렉터리 설정 -WORKDIR /app - -# 프로젝트 소스 코드와 Gradle 파일 복사 -COPY gradlew ./ -COPY gradle/ ./gradle -COPY build.gradle settings.gradle ./ -COPY src/ ./src - -# 줄바꿈 형식 변경 및 Gradle 실행 권한 추가 -RUN dos2unix gradlew -RUN chmod +x ./gradlew - -# Gradle 빌드 실행 -RUN bash ./gradlew clean build -x test - -# 포트 노출 -EXPOSE 8080 - -# 환경 변수 설정 -ENV spring.jwt.secret=s5GFED7YjUOFHe3K6jvVk2CalMUU//B2iOBpzSn/WqA= - -# 빌드된 JAR 파일 실행 -ENTRYPOINT ["java", "-jar", "build/libs/backend-0.0.1-SNAPSHOT.jar"] +#DockerFile +FROM openjdk:21-jdk-slim +ARG JAR_FILE=build/libs/*.jar +COPY ${JAR_FILE} app.jar +ENTRYPOINT ["java","-jar","/app.jar"] \ No newline at end of file diff --git a/backend/src/main/java/org/example/backend/board/controller/BoardController.java b/backend/src/main/java/org/example/backend/board/controller/BoardController.java index a91ae193..483647f5 100644 --- a/backend/src/main/java/org/example/backend/board/controller/BoardController.java +++ b/backend/src/main/java/org/example/backend/board/controller/BoardController.java @@ -28,7 +28,7 @@ public class BoardController { private final BoardService boardService; - @Operation(summary = "게시판 생성 API", description = "게시판 생성") + @Operation(summary = "게시판 생성 API 입니다.", description = "게시판 생성입니다.") @PostMapping public ResponseEntity createBoard(@RequestBody BoardReqDto boardReqDto) { Long boardId = boardService.saveBoard(boardReqDto);