Skip to content

Commit

Permalink
Testing github action
Browse files Browse the repository at this point in the history
  • Loading branch information
rocknroll17 committed Oct 6, 2024
1 parent 111bfd8 commit 031b809
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/deploy.yaml
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

0 comments on commit 031b809

Please sign in to comment.