Skip to content

Commit

Permalink
Test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
DouglasVDM committed Feb 13, 2024
1 parent 7bca744 commit 555cff3
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/ec2deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,21 @@ jobs:
- name: Pull Docker image
run: |
ssh -o StrictHostKeyChecking=no -i week2-keypair.pem ubuntu@${{ secrets.EC2_INSTANCE_IP }} 'sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:latest'
ssh -o StrictHostKeyChecking=no -i week2-keypair.pem ubuntu@${{ secrets.EC2_INSTANCE_IP }} '
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:latest
'
- name: Stop running container (if exists)
run: |
ssh -o StrictHostKeyChecking=no -i week2-keypair.pem ubuntu@${{ secrets.EC2_INSTANCE_IP }} 'sudo docker stop ${{ env.IMAGE_NAME }} || true'
ssh -o StrictHostKeyChecking=no -i week2-keypair.pem ubuntu@${{ secrets.EC2_INSTANCE_IP }} 'sudo docker rm ${{ env.IMAGE_NAME }} || true'
ssh -o StrictHostKeyChecking=no -i week2-keypair.pem ubuntu@${{ secrets.EC2_INSTANCE_IP }} '
sudo docker stop ${{ env.IMAGE_NAME }} || true
'
ssh -o StrictHostKeyChecking=no -i week2-keypair.pem ubuntu@${{ secrets.EC2_INSTANCE_IP }} '
sudo docker rm ${{ env.IMAGE_NAME }} || true
'
- name: Run new container
run: |
ssh -o StrictHostKeyChecking=no -i ${{ secrets.SSH_PRIVATE_KEY }} ubuntu@${{ secrets.EC2_INSTANCE_IP }} 'sudo docker run -d --name ${{ env.IMAGE_NAME }} -p 80:5000 ${{ secrets.DOCKER_USERNAME }}/rh-backend:latest'
ssh -o StrictHostKeyChecking=no -i week2-keypair.pem ubuntu@${{ secrets.EC2_INSTANCE_IP }} '
sudo docker run -d --name ${{ env.IMAGE_NAME }} -p 80:5000 ${{ secrets.DOCKER_USERNAME }}/rh-backend:latest
'

0 comments on commit 555cff3

Please sign in to comment.