Skip to content

Commit

Permalink
fixing cicd pipeline #3
Browse files Browse the repository at this point in the history
  • Loading branch information
parhamrahmani committed May 27, 2024
1 parent e422469 commit 278dd7c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy-to-ec2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ jobs:
- name: Update EC2 with new Docker image
run: |
for ip in ${{ env.EC2_1_IP }} ${{ env.EC2_2_IP }} ${{ env.EC2_3_IP }}; do
ssh -o StrictHostKeyChecking=no -i /home/runner/.ssh/id_rsa ubuntu@$ip << EOF
ssh -o StrictHostKeyChecking=no -i /home/runner/.ssh/id_rsa ubuntu@$ip << 'EOF'
docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/flask-app-image-repository:latest
docker stop my-container || true
docker rm my-container || true
docker run -d --name my-container -p 80:5000 ${{ secrets.DOCKER_HUB_USERNAME }}/flask-app-image-repository:latest
EOF
EOF
done
- name: Retrieve Autoscaling EC2 instance IDs
Expand All @@ -93,10 +93,10 @@ jobs:
ips_file="autoscaling_instance_ips.txt"
IFS=$'\n' read -d '' -r -a ips < "$ips_file"
for ip in "${ips[@]}"; do
ssh -o StrictHostKeyChecking=no -i /home/runner/.ssh/id_rsa ubuntu@$ip << EOF
ssh -o StrictHostKeyChecking=no -i /home/runner/.ssh/id_rsa ubuntu@$ip << 'EOF'
docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/flask-app-image-repository:latest
docker stop my-container || true
docker rm my-container || true
docker run -d --name my-container -p 80:5000 ${{ secrets.DOCKER_HUB_USERNAME }}/flask-app-image-repository:latest
EOF
EOF
done

0 comments on commit 278dd7c

Please sign in to comment.