diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index ebcf3e5..d25d5e2 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -28,3 +28,19 @@ jobs: file: ./Dockerfile push: true tags: evilharry1024/mouse-gaze:latest + - name: Install SSH client + run: | + sudo apt-get update + sudo apt-get install -y openssh-client + mkdir -p ~/.ssh + echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -H ${{ secrets.IP }} >> ~/.ssh/known_hosts + - name: Deploy to Server + run: | + ssh ubuntu@${{ secrets.IP }} << 'EOF' + sudo docker stop rats mouse || true + sudo docker rm rats mouse || true + sudo docker run --name rats -d -p 8002:8000 -v /home/ubuntu/mousegaze/conf/config.ini:/app/conf/config.ini evilharry1024/mouse-gaze uvicorn cmd.rats.rats:app --host 0.0.0.0 --port 8000 + sudo docker run --name mouse -d -p 8001:8000 -v /home/ubuntu/mousegaze/resource:/app/resource evilharry1024/mouse-gaze uvicorn cmd.mouse.mouse:app --host 0.0.0.0 --port 8000 + EOF \ No newline at end of file