docs:.github/deploy.yaml #2
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
name: Deploy FastAPI | |
on: | |
push: | |
branches: | |
- 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 | |
${{ secrets.USER_NAME }} | |
${{ secrets.PULL_KEY }} | |
cd /Controller | |
source myenv/bin/activate | |
pip install -r requirements.txt | |
uvicorn main:app --host 0.0.0.0 --port 1500 --reload & | |
EOF |