Add caching functionality to home controller #20
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 to EC2 | |
on: | |
push: | |
branches: | |
- main # Set this to the branch you want to deploy from | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Copy repository to EC2 | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USER }} | |
key: ${{ secrets.SSH_KEY }} | |
port: 22 | |
source: "." | |
target: "~/Shuno-Backend" | |
- name: Executing remote SSH commands | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USER }} | |
key: ${{ secrets.SSH_KEY }} | |
port: 22 | |
script: | | |
cd ~/Shuno-Backend | |
docker build -t shuno_backend . | |
docker stop shuno_backend || true | |
docker rm shuno_backend || true | |
docker run -d --name shuno_backend -p 5000:5000 shuno_backend | |
docker system prune -a --volumes -f |