Skip to content

Commit

Permalink
modify command further
Browse files Browse the repository at this point in the history
  • Loading branch information
devout-coder committed Sep 7, 2024
1 parent a8c1142 commit 8852a30
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,18 @@ jobs:
mkdir -p ~/.ssh
echo "${{ secrets.EC2_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
# SSH into EC2 and use docker-compose
- name: Deploy to EC2 using Docker Compose
- name: Add SSH known hosts (EC2 public IP or domain)
run: |
ssh-keyscan -H ${{ secrets.EC2_HOST }} >> ~/.ssh/known_hosts
- name: SSH into EC2 instance and execute a command
run: |
ssh -i ~/.ssh/id_rsa ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}
- name: Pull images and deploy
run: |
ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << 'EOF'
cd /home/ubuntu/doneify_dir
docker-compose pull doneify
docker-compose down
docker-compose up -d
EOF
env:
EC2_KEY: ${{ secrets.EC2_KEY }}

0 comments on commit 8852a30

Please sign in to comment.