-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (38 loc) · 1.18 KB
/
deploy.yml
File metadata and controls
40 lines (38 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Deploy AI Server to EC2
on:
push:
branches:
- developV2
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
environment: production
steps:
- name: Deploy to EC2
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
set -euo pipefail
set -x
cd ~/devpick-ai
git fetch origin developV2
git checkout developV2
git reset --hard origin/developV2
# env_file: .env 인 compose는 파일이 없으면 바로 실패하는 경우가 많음
[ -f .env ] || touch .env
if docker compose version >/dev/null 2>&1; then
DC="docker compose"
elif command -v docker-compose >/dev/null 2>&1; then
DC="docker-compose"
else
echo "Neither 'docker compose' nor 'docker-compose' is available."
exit 1
fi
$DC down --remove-orphans || true
docker builder prune -f || true
$DC build
$DC up -d