From 0f947200f1c836dd63dac74e893f6d8e8caf4d43 Mon Sep 17 00:00:00 2001 From: chaewonni <113420297+chaewonni@users.noreply.github.com> Date: Tue, 27 Aug 2024 00:35:02 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[feat]=20=EC=9A=B4=EC=98=81=20=EC=84=9C?= =?UTF-8?q?=EB=B2=84=20=EB=B0=B0=ED=8F=AC=20=EC=A4=80=EB=B9=84=20(#111)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [feat] #110 create Dockerfile-prod * [feat] #110 create prod-ci and prod-cd * [feat] #110 add discord webhook prod version * [feat] #110 update server_yml --- .github/workflows/prod-cd.yml | 62 +++++++++++++++++++++++++++ .github/workflows/prod-ci.yml | 28 ++++++++++++ Dockerfile-prod | 4 ++ SERVER_YML | 2 +- src/main/resources/logback-spring.xml | 8 ++++ 5 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/prod-cd.yml create mode 100644 .github/workflows/prod-ci.yml create mode 100644 Dockerfile-prod diff --git a/.github/workflows/prod-cd.yml b/.github/workflows/prod-cd.yml new file mode 100644 index 0000000..14df26f --- /dev/null +++ b/.github/workflows/prod-cd.yml @@ -0,0 +1,62 @@ +name: prod-CD +on: + push: + branches: [ "main" ] + +jobs: + ci: + runs-on: ubuntu-22.04 + env: + working-directory: . + + + steps: + - name: checkout + uses: actions/checkout@v3 + with: + submodules: true + token: ${{ secrets.SUBMODULE_TOKEN }} + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'corretto' + java-version: '17' + + - name: build + run: | + chmod +x gradlew + ./gradlew build -x test + shell: bash + + - name: docker login + uses: docker/setup-buildx-action@v2.9.1 + + - name: login docker hub + uses: docker/login-action@v2.2.0 + with: + username: ${{ secrets.DOCKER_LOGIN_USERNAME }} + password: ${{ secrets.DOCKER_LOGIN_ACCESSTOKEN }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile-prod + push: true + tags: ${{ secrets.DOCKER_LOGIN_USERNAME }}/${{ secrets.PROD_REPONAME }} + + cd: + needs: ci + runs-on: ubuntu-22.04 + + steps: + - name: docker container run + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.PROD_SERVER_IP }} + username: ${{ secrets.PROD_SERVER_USER }} + key: ${{ secrets.PROD_SERVER_KEY }} + script: | + cd ~ + ./deploy.sh diff --git a/.github/workflows/prod-ci.yml b/.github/workflows/prod-ci.yml new file mode 100644 index 0000000..f215b66 --- /dev/null +++ b/.github/workflows/prod-ci.yml @@ -0,0 +1,28 @@ +name: prod-CI + +on: + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - name: checkout + uses: actions/checkout@v3 + with: + submodules: true + token: ${{ secrets.SUBMODULE_TOKEN }} + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'corretto' + java-version: '17' + + - name: build + run: | + chmod +x gradlew + ./gradlew build -x test + shell: bash \ No newline at end of file diff --git a/Dockerfile-prod b/Dockerfile-prod new file mode 100644 index 0000000..875beb1 --- /dev/null +++ b/Dockerfile-prod @@ -0,0 +1,4 @@ +FROM amd64/amazoncorretto:17 +WORKDIR /app +COPY ./build/libs/server-0.0.1-SNAPSHOT.jar /app/KKUM-SERVER.jar +CMD ["java", "-Duser.timezone=Asia/Seoul", "-jar", "-Dspring.profiles.active=prod", "KKUM-SERVER.jar"] \ No newline at end of file diff --git a/SERVER_YML b/SERVER_YML index 4bff15b..81fc149 160000 --- a/SERVER_YML +++ b/SERVER_YML @@ -1 +1 @@ -Subproject commit 4bff15b5c3198ad44fddbe0aba8cfe9df7960f40 +Subproject commit 81fc149e4a7f4f4b485f1ab3deb7f354e24abc17 diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 2b6fd25..b6414f3 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -18,4 +18,12 @@ + + + + + + + + \ No newline at end of file From fb0f177ba7f89577a452187a2de12a3676245b3c Mon Sep 17 00:00:00 2001 From: chaewonni <113420297+chaewonni@users.noreply.github.com> Date: Fri, 30 Aug 2024 23:56:11 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[chore]=20=ED=81=B4=EB=9D=BC=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=95=A1=EC=84=B8?= =?UTF-8?q?=EC=8A=A4=20=ED=86=A0=ED=81=B0=20=EC=88=98=EB=AA=85=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20(#114)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [chore] #113 change access token expired time * [chore] #113 change access token expired time --- SERVER_YML | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SERVER_YML b/SERVER_YML index 81fc149..a0afbc7 160000 --- a/SERVER_YML +++ b/SERVER_YML @@ -1 +1 @@ -Subproject commit 81fc149e4a7f4f4b485f1ab3deb7f354e24abc17 +Subproject commit a0afbc7486d24fa93db498939c21c76d3c7dad13 From 1ab0b80994db77675564d226da0c01c74d3054ea Mon Sep 17 00:00:00 2001 From: tkdwns414 Date: Sat, 31 Aug 2024 00:15:21 +0900 Subject: [PATCH 3/3] [chore] submodule update --- SERVER_YML | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SERVER_YML b/SERVER_YML index 81fc149..a0afbc7 160000 --- a/SERVER_YML +++ b/SERVER_YML @@ -1 +1 @@ -Subproject commit 81fc149e4a7f4f4b485f1ab3deb7f354e24abc17 +Subproject commit a0afbc7486d24fa93db498939c21c76d3c7dad13