-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from DKU-Dgaja/chore-dev-CD
CD 파이프라인 추가
- Loading branch information
Showing
3 changed files
with
67 additions
and
0 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
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 |
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,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"] |