Skip to content

Commit

Permalink
[FIX] Fix bugs get container id rather than name
Browse files Browse the repository at this point in the history
  • Loading branch information
brubluenel committed Sep 6, 2024
1 parent 214ffb9 commit 1a0117b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@ jobs:
# Git clone instead of SCP
- name: Deploy code to Vultr
run: ssh -o StrictHostKeyChecking=no root@${{ secrets.VULTR_IP }} "cd /root/deploy/happiness-backend && git pull || git clone git@github.com:WAI-laboratory/happiness-backend.git /root/deploy/happiness-backend"
run: ssh -o StrictHostKeyChecking=no root@${{ secrets.VULTR_IP }} "cd /root/happiness-backend && git pull || git clone https://github.com/YOUR_REPO/happiness-backend.git /root/happiness-backend"

- name: Restart Docker container
run: |
ssh -o StrictHostKeyChecking=no root@${{ secrets.VULTR_IP }} "docker container stop happiness-backend || true"
ssh -o StrictHostKeyChecking=no root@${{ secrets.VULTR_IP }} "docker container rm happiness-backend || true"
ssh -o StrictHostKeyChecking=no root@${{ secrets.VULTR_IP }} "docker container run -d -p 80:3010 --name happiness-backend /root/deploy/happiness-backend"
ssh -o StrictHostKeyChecking=no root@${{ secrets.VULTR_IP }} "
if [ $(docker ps -q -f name=happiness-backend) ]; then
docker container stop happiness-backend;
fi;
if [ $(docker ps -a -q -f name=happiness-backend) ]; then
docker container rm happiness-backend;
fi;
docker container run -d -p 80:3010 --name happiness-backend /root/happiness-backend
"

0 comments on commit 1a0117b

Please sign in to comment.