From 555cff39b6afb416a9b9c0c44822bd5fd14f6a86 Mon Sep 17 00:00:00 2001 From: Douglas Van Der Merwe <74470226+DouglasVDM@users.noreply.github.com> Date: Tue, 13 Feb 2024 20:31:04 +0200 Subject: [PATCH] Test workflow --- .github/workflows/ec2deploy.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ec2deploy.yml b/.github/workflows/ec2deploy.yml index 410da73..60a1394 100644 --- a/.github/workflows/ec2deploy.yml +++ b/.github/workflows/ec2deploy.yml @@ -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' \ No newline at end of file + 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 + ' \ No newline at end of file