From e90caf0b6bb523f8ed0232d5007f97e5baa96743 Mon Sep 17 00:00:00 2001 From: nuyh Date: Mon, 27 Nov 2023 15:26:27 +0900 Subject: [PATCH] =?UTF-8?q?build:=20=EB=B0=B0=ED=8F=AC=20=EA=B3=BC?= =?UTF-8?q?=EC=A0=95=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.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 00b96b7..3a23af6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -47,7 +47,24 @@ jobs: host: ${{ secrets.HOST }} username: 'ubuntu' key: ${{ secrets.PRIVATE_KEY }} - script: /home/ubuntu/server/deploy.sh + script: | + cd /home/ubuntu/server + if sudo lsof -i :8080; + then + echo "Port 8080 is already in use. Killing the process..." + sudo lsof -i :8080 | awk 'NR!=1 {print $2}' | sudo xargs kill -9 + fi + + while lsof -i :8080 + do + echo "Wait for killing prior process..." + sleep 1 + done + + echo "Start Spring..." + sudo nohup java -jar -Dspring.profiles.active=prod -Duser.timezone=Asia/Seoul busan-0.0.1-SNAPSHOT.jar > nohup.out 2> nohup.err < /dev/null & + + echo "Finished!" - name: Docker build and push run: |