Skip to content

Commit

Permalink
Merge pull request #50 from DKU-Dgaja/chore-dev-CD
Browse files Browse the repository at this point in the history
CD 파이프라인 추가
  • Loading branch information
ghdcksgml1 authored Jan 20, 2024
2 parents 826e4bf + 07a1246 commit b51ffc4
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/CICD_dev_be_merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Spring Boot & Gradle CICD Jobs (With. dev branches push)

on:
push:
branches: [ dev ]

jobs:
build:
# 실행 환경 (Git Runners 개인 서버)
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'

# application.yml 파일 설정
- name: resources 폴더 생성
run: |
mkdir -p ./backend/src/main/resources
- name: yml 파일 생성
run: |
echo "${{ secrets.APPLICATION_DEFAULT_DEV }}" > ./backend/src/main/resources/application.yml
echo "${{ secrets.APPLICATION_DEV }}" > ./backend/src/main/resources/application-dev.yml
echo "${{ secrets.APPLICATION_DB }}" > ./backend/src/main/resources/database.yml
# gradlew를 실행시키기 위해 권한 부여
- name: Gradlew에게 실행권한 부여
run: chmod +x ./backend/gradlew

# 멀티모듈 빌드하기
- name: 멀티모듈 전체 빌드
run: |
cd ./backend
./gradlew clean build -x test
deployment:
name: docker deployment
needs: build # depends on
runs-on: self-hosted

steps:
- name: 도커 컴포즈 복사
run: echo "${{ secrets.DOCKER_COMPOSE_DEV }}" > ./backend/docker-compose.yml

- name: 도커 컴포즈 재실행
run: |
cd ./backend
docker-compose down
docker rmi `docker images | grep gitudy | awk '{print $3}'`
docker-compose up -d
2 changes: 2 additions & 0 deletions .github/workflows/CI_dev_be_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
test:
runs-on: self-hosted
needs: build
steps:
- name: Gradle 테스트
run: |
Expand All @@ -52,6 +53,7 @@ jobs:
coverage:
runs-on: self-hosted
needs: test
steps:
- name: 테스트 커버리지를 PR에 코멘트로 등록합니다
id: jacoco
Expand Down
11 changes: 11 additions & 0 deletions backend/Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Dockerfile-dev
FROM openjdk:17-jdk-slim

ARG PROFILE
ENV PROFILE=${PROFILE}

ARG JAR_FILE=/build/libs/backend-0.0.1-SNAPSHOT.jar

COPY ${JAR_FILE} /app.jar

ENTRYPOINT ["java","-jar","-Dspring.profiles.active=${PROFILE}", "/app.jar"]

0 comments on commit b51ffc4

Please sign in to comment.