generated from ImGdevel/springboot-base
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TOONPICK] v 0.1.1
- Loading branch information
Showing
3 changed files
with
82 additions
and
34 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,41 @@ | ||
name: TOONPICK CD (Docker Hub) | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 저장소 체크아웃 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Docker Build 및 Push (Docker Hub) | ||
env: | ||
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} | ||
REPOSITORY: "toonpick-service-app" | ||
run: | | ||
docker build -t $DOCKER_HUB_USERNAME/$REPOSITORY:latest ./backend | ||
echo "$DOCKER_HUB_PASSWORD" | docker login -u "$DOCKER_HUB_USERNAME" --password-stdin | ||
docker push $DOCKER_HUB_USERNAME/$REPOSITORY:latest | ||
- name: EC2에 SSH 접속하여 배포 실행 | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USER }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
script: | | ||
# 기존 컨테이너 중지 및 삭제 | ||
docker stop toonpick-service-app || true | ||
docker rm toonpick-service-app || true | ||
# 최신 이미지 다운로드 | ||
docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/toonpick-service-app:latest | ||
# 새 컨테이너 실행 | ||
docker run -d --name toonpick-service-app -p 8080:8080 ${{ secrets.DOCKER_HUB_USERNAME }}/toonpick-service-app:latest |
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,41 @@ | ||
name: TOONPICK Backend CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 저장소 체크아웃 | ||
uses: actions/checkout@v3 | ||
|
||
- name: JDK 17 설정 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Gradle 캐시 설정 (빌드 속도 최적화) | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.gradle/caches | ||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
gradle-${{ runner.os }}- | ||
- name: Gradle 실행 권한 추가 | ||
run: chmod +x backend/gradlew | ||
|
||
- name: Gradle 빌드 | ||
run: | | ||
cd backend | ||
./gradlew clean build -x test --no-daemon --parallel --configure-on-demand |