Skip to content

Commit

Permalink
Add variable EC2_PUBLIC_DNS
Browse files Browse the repository at this point in the history
  • Loading branch information
DouglasVDM committed Feb 11, 2024
1 parent 00dd1e8 commit e4354d5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ec2deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ jobs:
chmod 600 key.pem
- name: Pull Docker image
run: |
ssh -o StrictHostKeyChecking=no -i key.pem ubuntu@your-ec2-instance-ip 'sudo docker pull douglasvdmerwe/rh-backend:latest'
ssh -o StrictHostKeyChecking=no -i key.pem ${{ secrets.EC2_PUBLIC_DNS }} 'sudo docker pull douglasvdmerwe/rh-backend:latest'
- name: Stop running container
run: |
ssh -o StrictHostKeyChecking=no -i key.pem ubuntu@your-ec2-instance-ip 'sudo docker stop rh-backend || true'
ssh -o StrictHostKeyChecking=no -i key.pem ubuntu@your-ec2-instance-ip 'sudo docker rm rh-backend || true'
ssh -o StrictHostKeyChecking=no -i key.pem ${{ secrets.EC2_PUBLIC_DNS }} 'sudo docker stop rh-backend || true'
ssh -o StrictHostKeyChecking=no -i key.pem ${{ secrets.EC2_PUBLIC_DNS }} 'sudo docker rm rh-backend || true'
- name: Run new container
run: |
ssh -o StrictHostKeyChecking=no -i key.pem ubuntu@your-ec2-instance-ip 'sudo docker run -d --name rh-backend -p 80:3000 douglasvdmerwe/rh-backend:latest'
ssh -o StrictHostKeyChecking=no -i key.pem ${{ secrets.EC2_PUBLIC_DNS }} 'sudo docker run -d --name rh-backend -p 80:5000 douglasvdmerwe/rh-backend:latest'

0 comments on commit e4354d5

Please sign in to comment.