Skip to content

Commit 52fcc0e

Browse files
authored
Update deploy.yml
1 parent ec8d002 commit 52fcc0e

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

.github/workflows/deploy.yml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ permissions:
88
contents: read
99
packages: write
1010

11+
# (선택) 동시 배포 충돌 방지
12+
concurrency:
13+
group: debugvisual-ec2-deploy
14+
cancel-in-progress: true
15+
1116
jobs:
1217
build-push-deploy:
1318
runs-on: ubuntu-latest
@@ -44,26 +49,22 @@ jobs:
4449
ghcr.io/dmu-debugvisual/debugvisual-backend:latest
4550
ghcr.io/dmu-debugvisual/debugvisual-backend:${{ github.sha }}
4651
47-
48-
49-
5052
# EC2 배포 (익명 pull)
5153
- name: Deploy on EC2 (compose pull/up)
52-
uses: appleboy/ssh-action@v1.2.0
53-
with:
54-
host: ${{ secrets.EC2_HOST }}
55-
username: ${{ secrets.EC2_USER }} # ec2-user
56-
key: ${{ secrets.EC2_KEY }} # PEM 전체 내용
57-
script: |
58-
set -e
59-
LOCK=/tmp/debugvisual.deploy.lock
60-
(
61-
flock -n 9 || { echo 'Another deploy is running. Skip.'; exit 0; }
62-
cd ~/apps/debugvisual
63-
docker logout ghcr.io || true # 익명 pull 강제
64-
docker compose pull --ignore-pull-failures backend
65-
docker compose up -d --wait --remove-orphans backend
66-
docker image prune -af || true
67-
curl -skI https://api.zivorp.com/healthz | head -n1
68-
) 9>$LOCK
69-
54+
uses: appleboy/ssh-action@v1.2.0
55+
with:
56+
host: ${{ secrets.EC2_HOST }}
57+
username: ${{ secrets.EC2_USER }} # ec2-user
58+
key: ${{ secrets.EC2_KEY }} # PEM 전체 내용
59+
script: |
60+
set -e
61+
LOCK=/tmp/debugvisual.deploy.lock
62+
(
63+
flock -n 9 || { echo 'Another deploy is running. Skip.'; exit 0; }
64+
cd ~/apps/debugvisual
65+
docker logout ghcr.io || true # 익명 pull 강제
66+
docker compose pull --ignore-pull-failures backend
67+
docker compose up -d --wait --remove-orphans backend
68+
docker image prune -af || true
69+
curl -skI https://api.zivorp.com/healthz | head -n1
70+
) 9>$LOCK

0 commit comments

Comments
 (0)