Add files via upload #17
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 Flask API to Azure VM | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flask | |
- name: Deploy to virtual machine | |
run: | | |
# Use SSH to connect to the VM and run deployment commands | |
ssh -i path/to/your/key.pem azureuser@20.2.219.112 "cd simple-backend-api && git pull origin main && python -m pip install -r requirements.txt && python app.py" |