🎨 add the versioning framework to requirements #6
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 to Remote Server | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Build Docker Image | |
run: docker build -t my_fastapi_app . | |
- name: Save Docker Image | |
run: docker save -o my_fastapi_app.tar my_fastapi_app | |
- name: Copy Docker Image to Remote Server | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
key: ${{ secrets.SSH_KEY }} | |
source: "./my_fastapi_app.tar" | |
target: "/root/QISsy" | |
- name: Deploy to Remote Server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
docker stop my_fastapi_app || true | |
docker rm my_fastapi_app || true | |
docker load < /root/QISsy/my_fastapi_app.tar | |
docker run -d --name my_fastapi_app -p 8000:8000 my_fastapi_app |