-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
111bfd8
commit 031b809
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Deploy FastAPI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # main 브랜치에 커밋이 푸시될 때마다 실행됩니다. | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up SSH | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
|
||
- name: Deploy to EC2 | ||
run: | | ||
ssh -o StrictHostKeyChecking=no ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << 'EOF' | ||
cd /planner # FastAPI 프로젝트 디렉토리로 이동 | ||
git pull origin main # 최신 커밋 가져오기 | ||
cd /Controller | ||
source myenv/bin/activate # 가상 환경 활성화 (필요한 경우) | ||
pip install -r requirements.txt # 의존성 설치 | ||
uvicorn main:app --host 0.0.0.0 --port 1500 --reload & # FastAPI 서버 시작 | ||
EOF |