Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhquang111 committed Aug 26, 2024
1 parent 6885d9e commit 4b80e84
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/aws-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ jobs:
PRIVATE_KEY: ${{ secrets.EC2_SSH_PRIVATE_KEY }}
HOST: ${{ secrets.EC2_HOST }}
USER: ec2-user
IMAGE: $CONTAINER_NAME:$IMAGE_TAG
IMAGE: ${{ env.CONTAINER_NAME }}:${{ env.IMAGE_TAG }}
run: |
echo "$PRIVATE_KEY" > private_key.pem
chmod 600 private_key.pem
ssh -i private_key.pem -o StrictHostKeyChecking=no ${USER}@${HOST} '
ssh -i private_key.pem -o StrictHostKeyChecking=no ${USER}@${HOST} << 'EOF'
IMAGE="${{ env.CONTAINER_NAME }}:${{ env.IMAGE_TAG }}"
sudo docker pull $IMAGE
sudo docker stop my-container || true
sudo docker rm my-container || true
sudo docker run -d --name my-container -p 80:8080 $IMAGE'
sudo docker run -d --name my-container -p 80:8080 $IMAGE
EOF

0 comments on commit 4b80e84

Please sign in to comment.