Skip to content

Commit

Permalink
feat: test
Browse files Browse the repository at this point in the history
  • Loading branch information
miro-ring committed Jan 10, 2024
1 parent 079653c commit b3c54c6
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ jobs:
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
- name: Deploy to EC2
run: |
echo "${{ secrets.EC2_SSH_PRIVATE_KEY }}" > private_key.pem
chmod 400 private_key.pem
ssh -i private_key.pem -o StrictHostKeyChecking=no ubuntu@${{ secrets.EC2_PUBLIC_DOMAIN }} "
aws ecr get-login-password --region ap-northeast-2 |
sudo docker login --username AWS --password-stdin ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} &&
echo "chk" &&
echo ${{ env.IMAGE_NAME }} &&
if [ \$(sudo docker ps -q -f name=${{ env.IMAGE_NAME }}) ]; then
echo "chk2" &&
echo ${{ env.IMAGE_NAME }} &&
sudo docker stop ${{ env.IMAGE_NAME }} &&
sudo docker rm ${{ env.IMAGE_NAME }}
fi &&
sudo docker image pull ${{ steps.meta.outputs.tags }} &&
sudo docker container run --name ${{ env.IMAGE_NAME }} -d -p 3000:3000 ${{ steps.meta.outputs.tags }}"
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: ${{ env.IMAGE_NAME }}
IMAGE_TAG: ${{ github.sha }}
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_PUBLIC_DOMAIN }}
username: ubuntu
key: ${{ secrets.EC2_SSH_PRIVATE_KEY }}
envs: REGISTRY,REPOSITORY,IMAGE_TAG,AWS_REGION,IMAGE_NAME
scripts: |-
aws ecr get-login-password --region ${{ env.AWS_REGION }}
sudo docker stop ${{ env.IMAGE_NAME }} || true
sudo docker rm ${{ env.IMAGE_NAME }} || true
sudo docker pull $REGISTRY/$REPOSITORY:$IMAGE_TAG
sudo docker container run --name ${{ env.IMAGE_NAME }} -d -p 3000:3000 $REGISTRY/$REPOSITORY:$IMAGE_TAG

0 comments on commit b3c54c6

Please sign in to comment.