From 8548c4d3a25fb21eea1da9fd8e23382d72e9e672 Mon Sep 17 00:00:00 2001 From: hellozo0 Date: Sat, 6 Jan 2024 03:48:01 +0900 Subject: [PATCH 1/8] =?UTF-8?q?#15=20[feat]=20CI.yml=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CI.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/CI.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 00000000..e3b50082 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,36 @@ +name: MODDY DEV CI + +on: + push: + branched: [ "develop" ] + pull_request: + branches: [ "develop" ] + +jobs: + build: + runs-on: ubuntu-22.04 + env: + working-directory: moddy-server + + steps: + - name: 체크아웃 + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'corretto' + java-version: '17' + + - name: application.yml 생성 + run: | + cd src/main/resources + echo "${{ secrets.APPLICATION }}" > ./application.yml + working-directory: ${{ env.working-directory }} + + - name: 빌드 + run: | + chmod +x gradlew + ./gradlew build -x test + working-directory: ${{ env.working-directory }} + shell: bash From a5c376604b78e716c078e1ee613e9963ac97b9be Mon Sep 17 00:00:00 2001 From: hellozo0 Date: Sat, 6 Jan 2024 04:03:48 +0900 Subject: [PATCH 2/8] =?UTF-8?q?#15=20[feat]=20Dockerfile=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..021b900f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM amd64/amazoncorretto:17 + +WORKDIR /app + +COPY ./build/libs/moddy-server-0.0.1-SNAPSHOT.jar /app/moddy-server.jar + +CMD ["java", "-Duser.timezone=Asia/Seoul", "-jar", "-Dspring.profiles.active=test", "moddy-server.jar"] + From e2940f26555143fb44984ccfb8e190ce19c04ea5 Mon Sep 17 00:00:00 2001 From: hellozo0 Date: Sat, 6 Jan 2024 04:22:49 +0900 Subject: [PATCH 3/8] =?UTF-8?q?#15=20[feat]=20CD.yml=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CD.yml | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/CD.yml diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml new file mode 100644 index 00000000..581025da --- /dev/null +++ b/.github/workflows/CD.yml @@ -0,0 +1,66 @@ +name: MODDY DEV CD + +on: + push: + branches: [ "develop" ] + +jobs: + deploy-ci + runs-on: ubuntu-22.04 + env: + working-directory: moddy-server + + steps: + - name: 체크아웃 + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'corretto' + java-version: '17' + + - name: application.yml 생성 + run: | + cd src/main/resources + echo "${{ secrets.APPLICATION }}" > ./application.yml + working-directory: ${{ env.working-directory }} + + - name: 빌드 + run: | + chmod +x gradlew + ./gradlew build -x test + working-directory: ${{ env.working-directory }} + shell: bash + +######## 여기까지는 CI.yml와 동일 ######### + + - name: docker build 가능하도록 환경 설정 + uses: docker/setup-buildx-action@v2.9.1 + + - name: docker hub에로그인 + uses: docker/login-action@v2.2.0 + with: + username: ${{ secrets.DOCKERHUB_LOGIN_USERNAME }} + password: ${{ secrets.DOCKERHUB_LOGIN_ACCESSTOKEN }} + + - name: docker image 빌드 및 푸시 + run: | + docker build --platform linux/amd64 -t moddy1217/moddy-server . + docker push moddy1217/moddy-server + working-directory: ${{ env.working-directory }} + + deploy-cd: + needs: deploy-ci + runs-on: ubuntu-22.04 + + steps: + - name: 도커 컨테이너 실행 + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.RELEASE_SERVER_IP }} + username: ${{ secrets.RELEASE_SERVER_USER }} + key: ${{ secrets.RELEASE_SERVER_KEY }} + script: | + cd ~ + ./deploy.sh From 6fc4bae0b678186e644b19fe64c7eb9521056be5 Mon Sep 17 00:00:00 2001 From: hellozo0 Date: Sat, 6 Jan 2024 04:46:55 +0900 Subject: [PATCH 4/8] =?UTF-8?q?#15=20[fix]=20CI.yml=20=EC=98=A4=ED=83=80?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e3b50082..8ef15171 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -2,7 +2,7 @@ name: MODDY DEV CI on: push: - branched: [ "develop" ] + branches: [ "develop" ] pull_request: branches: [ "develop" ] From f57025a056bff91bf0c67fcfbeb27fa788bf92ff Mon Sep 17 00:00:00 2001 From: hellozo0 Date: Sat, 6 Jan 2024 04:47:36 +0900 Subject: [PATCH 5/8] =?UTF-8?q?#15=20[fix]=20CD.yml=20=EC=98=A4=ED=83=80?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index 581025da..23f1087b 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -5,7 +5,7 @@ on: branches: [ "develop" ] jobs: - deploy-ci + deploy-ci: runs-on: ubuntu-22.04 env: working-directory: moddy-server From f5e0816c35fb2d229017228eef125b6df18a9aca Mon Sep 17 00:00:00 2001 From: hellozo0 Date: Sat, 6 Jan 2024 23:49:22 +0900 Subject: [PATCH 6/8] =?UTF-8?q?#15=20[fix]=20CI.yml=20=EC=B5=9C=EC=83=81?= =?UTF-8?q?=EC=9C=84=20=ED=8F=B4=EB=8D=94=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CI.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8ef15171..8376cbf4 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -26,7 +26,6 @@ jobs: run: | cd src/main/resources echo "${{ secrets.APPLICATION }}" > ./application.yml - working-directory: ${{ env.working-directory }} - name: 빌드 run: | From 8e1146b12f95560c4af2327304d38f966e6ec3bd Mon Sep 17 00:00:00 2001 From: hellozo0 Date: Sat, 6 Jan 2024 23:52:30 +0900 Subject: [PATCH 7/8] =?UTF-8?q?#15=20[fix]=20CI.yml=20=EB=B9=8C=EB=93=9C?= =?UTF-8?q?=EC=8B=9C=20=EC=B5=9C=EC=83=81=EC=9C=84=20=ED=8F=B4=EB=8D=94?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=8F=99=ED=95=98=EB=8A=94=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CI.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8376cbf4..4f270e0a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -31,5 +31,4 @@ jobs: run: | chmod +x gradlew ./gradlew build -x test - working-directory: ${{ env.working-directory }} shell: bash From 28b8e5cadaf70f0b2497d16db6ea71b2f5d69585 Mon Sep 17 00:00:00 2001 From: hellozo0 Date: Sun, 7 Jan 2024 00:01:56 +0900 Subject: [PATCH 8/8] =?UTF-8?q?#15=20[fix]=20CD.yml=20=EC=B5=9C=EC=83=81?= =?UTF-8?q?=EC=9C=84=20=ED=8F=B4=EB=8D=94=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CD.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index 23f1087b..70e818d0 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -5,7 +5,7 @@ on: branches: [ "develop" ] jobs: - deploy-ci: + deploy-ci runs-on: ubuntu-22.04 env: working-directory: moddy-server @@ -24,13 +24,11 @@ jobs: run: | cd src/main/resources echo "${{ secrets.APPLICATION }}" > ./application.yml - working-directory: ${{ env.working-directory }} - name: 빌드 run: | chmod +x gradlew ./gradlew build -x test - working-directory: ${{ env.working-directory }} shell: bash ######## 여기까지는 CI.yml와 동일 ######### @@ -48,7 +46,6 @@ jobs: run: | docker build --platform linux/amd64 -t moddy1217/moddy-server . docker push moddy1217/moddy-server - working-directory: ${{ env.working-directory }} deploy-cd: needs: deploy-ci