forked from Mireutale/Project_API
-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (29 loc) · 807 Bytes
/
deploy.yml
File metadata and controls
34 lines (29 loc) · 807 Bytes
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
name: Deploy FastAPI Backend to EC2
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Copy to EC2 (carrot.db 제외)
uses: appleboy/scp-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_KEY }}
source: "."
target: "~/backend-app"
exclude: "carrot.db"
- name: SSH - Deploy Backend
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_KEY }}
script: |
cd ~/backend-app
sudo docker-compose down
sudo docker-compose up -d --build