From 8ef0f7332cc71eeb1513ec0ae353454f346a91ef Mon Sep 17 00:00:00 2001 From: katejhee Date: Wed, 2 Jul 2025 03:08:09 +0900 Subject: [PATCH 01/19] chore: CI/CD workflows --- .github/workflows/dev.build.yml | 48 ++++++++++++++++++++++++++++++++ .github/workflows/dev.deploy.yml | 29 +++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 .github/workflows/dev.build.yml create mode 100644 .github/workflows/dev.deploy.yml diff --git a/.github/workflows/dev.build.yml b/.github/workflows/dev.build.yml new file mode 100644 index 00000000..a48498e2 --- /dev/null +++ b/.github/workflows/dev.build.yml @@ -0,0 +1,48 @@ +name: Build and Push to DockerHub + +on: + push: + branches: [ dev ] + pull_request: + branches: [ dev ] +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'temurin' + + - name: Set up Gradle cache + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }} + + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew + + - name: Build with Gradle + run: ./gradlew clean build + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build Docker image + run: docker build -t ${{ secrets.DOCKER_IMAGE_NAME }} . + + - name: Push Docker image + run: docker push ${{ secrets.DOCKER_IMAGE_NAME }} diff --git a/.github/workflows/dev.deploy.yml b/.github/workflows/dev.deploy.yml new file mode 100644 index 00000000..15064429 --- /dev/null +++ b/.github/workflows/dev.deploy.yml @@ -0,0 +1,29 @@ +name: Deploy to EC2 + +on: + push: + branches: [ dev ] + pull_request: + branches: [ dev ] + +jobs: + deploy: + needs: build + runs-on: ubuntu-latest + + steps: + - name: Deploy on EC2 via SSH + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.EC2_HOST }} + username: ${{ secrets.EC2_USER }} + key: ${{ secrets.EC2_KEY }} + script: | + sudo timedatectl set-timezone Asia/Seoul + + docker pull ${{ secrets.DOCKER_IMAGE_NAME }} + + docker stop bookmark-app || true + docker rm bookmark-app || true + + docker run -d -p 8080:8080 --env-file ~/app/.env --name bookmark-app ${{ secrets.DOCKER_IMAGE_NAME }} From 4706fa5fb74ecda5f0c2b0d49a2a90d7add216a9 Mon Sep 17 00:00:00 2001 From: katejhee Date: Sun, 6 Jul 2025 01:40:40 +0900 Subject: [PATCH 02/19] =?UTF-8?q?fix:.gitignore=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c2065bc2..5fee5ba7 100644 --- a/.gitignore +++ b/.gitignore @@ -34,4 +34,5 @@ out/ /.nb-gradle/ ### VS Code ### -.vscode/ +.vscode/.env +.env From 1874d706411991ad7a62131f79a387f91d40d45f Mon Sep 17 00:00:00 2001 From: katejhee Date: Wed, 2 Jul 2025 03:14:11 +0900 Subject: [PATCH 03/19] =?UTF-8?q?chore:dockerfile,workflow=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 3 +++ .github/workflows/dev.deploy.yml | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 00000000..a122c292 --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +DB_URL=jdbc:mysql://bookmark-db.cpcgeg8icg9s.ap-southeast-2.rds.amazonaws.com:3306/bookmark +DB_USER=admin +DB_PASSWORD=bookmarkbe1 diff --git a/.github/workflows/dev.deploy.yml b/.github/workflows/dev.deploy.yml index 15064429..38a9837b 100644 --- a/.github/workflows/dev.deploy.yml +++ b/.github/workflows/dev.deploy.yml @@ -7,6 +7,25 @@ on: branches: [ dev ] jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '21' + + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew + + - name: Build with Gradle + run: ./gradlew clean build + deploy: needs: build runs-on: ubuntu-latest From 64d4b4f28fa05eddbed5c186c050a59d5a65b8a4 Mon Sep 17 00:00:00 2001 From: katejhee Date: Wed, 2 Jul 2025 03:14:11 +0900 Subject: [PATCH 04/19] =?UTF-8?q?fix:dockerfile,workflow=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 +- Dockerfile | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/.env b/.env index a122c292..7675ce77 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ DB_URL=jdbc:mysql://bookmark-db.cpcgeg8icg9s.ap-southeast-2.rds.amazonaws.com:3306/bookmark -DB_USER=admin +DB_USERNAME=admin DB_PASSWORD=bookmarkbe1 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..4a1a18e3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM openjdk:21 +COPY build/libs/bookmark-0.0.1-SNAPSHOT.jar app.jar +ENTRYPOINT ["java", "-jar", "/app.jar"] \ No newline at end of file From d81bcb1d2f0fce91e966bacc99cb104bea3953c7 Mon Sep 17 00:00:00 2001 From: katejhee Date: Thu, 3 Jul 2025 14:03:19 +0900 Subject: [PATCH 05/19] =?UTF-8?q?fix:dev.deploy=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev.deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dev.deploy.yml b/.github/workflows/dev.deploy.yml index 38a9837b..337cc625 100644 --- a/.github/workflows/dev.deploy.yml +++ b/.github/workflows/dev.deploy.yml @@ -27,7 +27,6 @@ jobs: run: ./gradlew clean build deploy: - needs: build runs-on: ubuntu-latest steps: From 9a7ad11103b85ed5c990c7e1745242563e74a91a Mon Sep 17 00:00:00 2001 From: katejhee Date: Thu, 3 Jul 2025 21:41:51 +0900 Subject: [PATCH 06/19] =?UTF-8?q?fix:.env=EB=A5=BC=20.gitignore=EB=A1=9C?= =?UTF-8?q?=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: .gitignore 수정 --- gradlew | 0 .../leets/bookmark/controller/HelloController.java | 13 +++++++++++++ "\353\202\230\354\231\200\354\225\274" | 0 3 files changed, 13 insertions(+) mode change 100644 => 100755 gradlew create mode 100644 src/main/java/leets/bookmark/controller/HelloController.java create mode 100644 "\353\202\230\354\231\200\354\225\274" diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/src/main/java/leets/bookmark/controller/HelloController.java b/src/main/java/leets/bookmark/controller/HelloController.java new file mode 100644 index 00000000..35a1ff97 --- /dev/null +++ b/src/main/java/leets/bookmark/controller/HelloController.java @@ -0,0 +1,13 @@ +package leets.bookmark.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class HelloController { + + @GetMapping("/hello") + public String hello() { + return "Hello, BookMark!"; + } +} diff --git "a/\353\202\230\354\231\200\354\225\274" "b/\353\202\230\354\231\200\354\225\274" new file mode 100644 index 00000000..e69de29b From ab751947842f9fd27407b066975c3f3652ebfee2 Mon Sep 17 00:00:00 2001 From: katejhee Date: Thu, 3 Jul 2025 21:45:37 +0900 Subject: [PATCH 07/19] =?UTF-8?q?fix:=EB=A3=A8=ED=8A=B8=EA=B2=BD=EB=A1=9C?= =?UTF-8?q?=20=EB=A7=A4=ED=95=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix:루트경로매핑 --- .../java/leets/bookmark/controller/HelloController.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/leets/bookmark/controller/HelloController.java b/src/main/java/leets/bookmark/controller/HelloController.java index 35a1ff97..12f71c51 100644 --- a/src/main/java/leets/bookmark/controller/HelloController.java +++ b/src/main/java/leets/bookmark/controller/HelloController.java @@ -10,4 +10,9 @@ public class HelloController { public String hello() { return "Hello, BookMark!"; } -} + + @GetMapping("/") + public String root() { + return "Welcome to the BookMark API!"; + } +} \ No newline at end of file From 62392e9d5ec8737e0b8dc1f136e143aaed4c3577 Mon Sep 17 00:00:00 2001 From: katejhee Date: Fri, 4 Jul 2025 22:33:28 +0900 Subject: [PATCH 08/19] =?UTF-8?q?fix:deploy,build-dev=20=EC=9D=B4=EB=A6=84?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD,=20deploy-dev.yml=20=EB=82=B4=EC=9A=A9?= =?UTF-8?q?=EC=88=98=EC=A0=95,=20=ED=95=84=EC=9A=94=EC=97=86=EB=8A=94=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix:deploy,build-dev 이름 변경, deploy-dev.yml 내용수정, 필요없는 파일 삭제 --- .../workflows/{dev.build.yml => build-dev.yml} | 0 .../{dev.deploy.yml => deploy-dev.yml} | 3 +++ .../bookmark/controller/HelloController.java | 18 ------------------ "\353\202\230\354\231\200\354\225\274" | 0 4 files changed, 3 insertions(+), 18 deletions(-) rename .github/workflows/{dev.build.yml => build-dev.yml} (100%) rename .github/workflows/{dev.deploy.yml => deploy-dev.yml} (95%) delete mode 100644 src/main/java/leets/bookmark/controller/HelloController.java delete mode 100644 "\353\202\230\354\231\200\354\225\274" diff --git a/.github/workflows/dev.build.yml b/.github/workflows/build-dev.yml similarity index 100% rename from .github/workflows/dev.build.yml rename to .github/workflows/build-dev.yml diff --git a/.github/workflows/dev.deploy.yml b/.github/workflows/deploy-dev.yml similarity index 95% rename from .github/workflows/dev.deploy.yml rename to .github/workflows/deploy-dev.yml index 337cc625..751769d6 100644 --- a/.github/workflows/dev.deploy.yml +++ b/.github/workflows/deploy-dev.yml @@ -6,6 +6,7 @@ on: pull_request: branches: [ dev ] + jobs: build: runs-on: ubuntu-latest @@ -27,6 +28,8 @@ jobs: run: ./gradlew clean build deploy: + needs: build + if: github.event_name == 'push' runs-on: ubuntu-latest steps: diff --git a/src/main/java/leets/bookmark/controller/HelloController.java b/src/main/java/leets/bookmark/controller/HelloController.java deleted file mode 100644 index 12f71c51..00000000 --- a/src/main/java/leets/bookmark/controller/HelloController.java +++ /dev/null @@ -1,18 +0,0 @@ -package leets.bookmark.controller; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -public class HelloController { - - @GetMapping("/hello") - public String hello() { - return "Hello, BookMark!"; - } - - @GetMapping("/") - public String root() { - return "Welcome to the BookMark API!"; - } -} \ No newline at end of file diff --git "a/\353\202\230\354\231\200\354\225\274" "b/\353\202\230\354\231\200\354\225\274" deleted file mode 100644 index e69de29b..00000000 From db7ddcaf00ba6a5739994df97e1bfb32f95b45e4 Mon Sep 17 00:00:00 2001 From: katejhee Date: Fri, 4 Jul 2025 23:35:46 +0900 Subject: [PATCH 09/19] =?UTF-8?q?fix:.env=EB=A5=BC=20.gitignore=EB=A1=9C?= =?UTF-8?q?=20=EC=98=AE=EA=B9=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 3 --- .gitignore | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index 7675ce77..00000000 --- a/.env +++ /dev/null @@ -1,3 +0,0 @@ -DB_URL=jdbc:mysql://bookmark-db.cpcgeg8icg9s.ap-southeast-2.rds.amazonaws.com:3306/bookmark -DB_USERNAME=admin -DB_PASSWORD=bookmarkbe1 diff --git a/.gitignore b/.gitignore index 5fee5ba7..79711423 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ out/ ### VS Code ### .vscode/.env .env +.env From eb824f430dd5b5a2195f393a43218590f984290e Mon Sep 17 00:00:00 2001 From: katejhee Date: Fri, 4 Jul 2025 23:38:47 +0900 Subject: [PATCH 10/19] =?UTF-8?q?fix:deploy.yml=20=EC=97=90=EC=84=9C=20dep?= =?UTF-8?q?loy=EC=99=80=20build=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-dev.yml | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 751769d6..94b10534 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -8,27 +8,7 @@ on: jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout source code - uses: actions/checkout@v3 - - - name: Set up JDK 21 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '21' - - - name: Grant execute permission for gradlew - run: chmod +x ./gradlew - - - name: Build with Gradle - run: ./gradlew clean build - deploy: - needs: build if: github.event_name == 'push' runs-on: ubuntu-latest From 5d6788d90a7315336e58cf91c99f6bf84a2dae8d Mon Sep 17 00:00:00 2001 From: katejhee Date: Sat, 5 Jul 2025 00:09:42 +0900 Subject: [PATCH 11/19] =?UTF-8?q?fix:needs:build=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-dev.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 94b10534..178c80bf 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -3,12 +3,11 @@ name: Deploy to EC2 on: push: branches: [ dev ] - pull_request: - branches: [ dev ] jobs: deploy: + needs: build if: github.event_name == 'push' runs-on: ubuntu-latest From 38a1234125d3fdf8490077cf66285bf868a40ef3 Mon Sep 17 00:00:00 2001 From: katejhee Date: Sat, 5 Jul 2025 00:10:39 +0900 Subject: [PATCH 12/19] =?UTF-8?q?fix:=EA=B0=9C=ED=96=89=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix:파일에 개행 추가 --- .github/workflows/build-dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml index a48498e2..f8b9c8a3 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/build-dev.yml @@ -46,3 +46,4 @@ jobs: - name: Push Docker image run: docker push ${{ secrets.DOCKER_IMAGE_NAME }} + From cb1b1f277e9c1de1b13855c937bbd2707ce7110a Mon Sep 17 00:00:00 2001 From: katejhee Date: Sat, 5 Jul 2025 22:21:23 +0900 Subject: [PATCH 13/19] =?UTF-8?q?fix:dockeerfile=EC=97=90=20=EA=B0=9C?= =?UTF-8?q?=ED=96=89=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4a1a18e3..5d639de7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,3 @@ FROM openjdk:21 COPY build/libs/bookmark-0.0.1-SNAPSHOT.jar app.jar -ENTRYPOINT ["java", "-jar", "/app.jar"] \ No newline at end of file +ENTRYPOINT ["java", "-jar", "/app.jar"] From f21336ae67cba51f01324fe05ce467fe9aa68db4 Mon Sep 17 00:00:00 2001 From: katejhee Date: Sat, 5 Jul 2025 22:29:13 +0900 Subject: [PATCH 14/19] =?UTF-8?q?fix:build-dev=EC=97=90=20=EA=B0=9C?= =?UTF-8?q?=ED=96=89=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-dev.yml | 1 - .github/workflows/deploy-dev.yml | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml index f8b9c8a3..a48498e2 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/build-dev.yml @@ -46,4 +46,3 @@ jobs: - name: Push Docker image run: docker push ${{ secrets.DOCKER_IMAGE_NAME }} - diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 178c80bf..51e40d26 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -4,10 +4,8 @@ on: push: branches: [ dev ] - jobs: deploy: - needs: build if: github.event_name == 'push' runs-on: ubuntu-latest @@ -19,7 +17,10 @@ jobs: username: ${{ secrets.EC2_USER }} key: ${{ secrets.EC2_KEY }} script: | - sudo timedatectl set-timezone Asia/Seoul + CURRENT_TZ=$(timedatectl | grep "Time zone" | awk '{print $3}') + if [ "$CURRENT_TZ" != "Asia/Seoul" ]; then + sudo timedatectl set-timezone Asia/Seoul + fi docker pull ${{ secrets.DOCKER_IMAGE_NAME }} From 12c879021b0a355e6195d3e73889fc74e0e23c17 Mon Sep 17 00:00:00 2001 From: katejhee Date: Sat, 5 Jul 2025 22:41:06 +0900 Subject: [PATCH 15/19] =?UTF-8?q?fix:deploy-dev.yml,=20build-dev.yml=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-dev.yml | 2 +- .github/workflows/deploy-dev.yml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml index a48498e2..607cac0d 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/build-dev.yml @@ -1,4 +1,4 @@ -name: Build and Push to DockerHub +name: Build Job (Dev) on: push: diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 51e40d26..b039401c 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -1,8 +1,10 @@ name: Deploy to EC2 on: - push: - branches: [ dev ] + workflow_run: + workflows: ["Build and Push to DockerHub"] + types: + - completed jobs: deploy: From 98a58a5ad4b3efac77547ed528aba992cad3c0a1 Mon Sep 17 00:00:00 2001 From: katejhee Date: Sat, 5 Jul 2025 22:42:29 +0900 Subject: [PATCH 16/19] =?UTF-8?q?fix:.env=20=ED=95=98=EB=82=98=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 79711423..5fee5ba7 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,3 @@ out/ ### VS Code ### .vscode/.env .env -.env From c69590778a90d58359ede3e3e70c4182e41eba31 Mon Sep 17 00:00:00 2001 From: katejhee Date: Sun, 6 Jul 2025 01:12:10 +0900 Subject: [PATCH 17/19] =?UTF-8?q?fix:deploy-dev.yml=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-dev.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index b039401c..8474528e 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -2,13 +2,13 @@ name: Deploy to EC2 on: workflow_run: - workflows: ["Build and Push to DockerHub"] + workflows: ["Build Job (Dev)"] types: - completed jobs: deploy: - if: github.event_name == 'push' + if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest steps: @@ -23,10 +23,7 @@ jobs: if [ "$CURRENT_TZ" != "Asia/Seoul" ]; then sudo timedatectl set-timezone Asia/Seoul fi - docker pull ${{ secrets.DOCKER_IMAGE_NAME }} - docker stop bookmark-app || true - docker rm bookmark-app || true - + docker rm -f bookmark-app || true docker run -d -p 8080:8080 --env-file ~/app/.env --name bookmark-app ${{ secrets.DOCKER_IMAGE_NAME }} From f07253c4b5e781ebb333a82767949a6e9419cac7 Mon Sep 17 00:00:00 2001 From: katejhee Date: Mon, 7 Jul 2025 15:02:58 +0900 Subject: [PATCH 18/19] =?UTF-8?q?fix:.gitignore=EC=97=90=20Caddyfile?= =?UTF-8?q?=EA=B3=BC=20localhost.pem=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 5fee5ba7..5ebd9c89 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,6 @@ out/ ### VS Code ### .vscode/.env .env +Caddyfile +localhost.pem +localhost-key.pem From 3c5bffc07611a6ae36cab6b7240795e2cf00ea7c Mon Sep 17 00:00:00 2001 From: katejhee Date: Mon, 7 Jul 2025 15:30:04 +0900 Subject: [PATCH 19/19] =?UTF-8?q?fix:.gitignore=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5ebd9c89..c6d01eda 100644 --- a/.gitignore +++ b/.gitignore @@ -34,7 +34,7 @@ out/ /.nb-gradle/ ### VS Code ### -.vscode/.env +.vscode/ .env Caddyfile localhost.pem