From 84ee87877b7e1eb32a8979a516ac8c498447ba78 Mon Sep 17 00:00:00 2001 From: gabang2 Date: Wed, 10 Jul 2024 00:58:10 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 43474c3..ccf491c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -28,17 +28,19 @@ jobs: aws-region: ap-northeast-2 # Step 4: Deploy to EC2 instance - - name: Deploy to EC2 - run: | - echo "${{ secrets.EC2_SSH_KEY }}" > key.pem - chmod 600 key.pem - ssh -o StrictHostKeyChecking=no -i key.pem -t ubuntu@${{ secrets.EC2_INSTANCE_IP }} << 'EOF' - docker pull public.ecr.aws/h7p2f6d8/ticats_ai:latest - docker-compose down - docker-compose up -d - EOF - env: - DATABASE_URL: ${{ secrets.DATABASE_URL }} + - name: Deploy to server + uses: appleboy/ssh-action@master + id: deploy + with: + host: ${{ secrets.EC2_INSTANCE_IP }} + username: ubuntu + key: ${{ secrets.EC2_SSH_KEY }} + envs: | + DATABASE_URL=${{ secrets.DATABASE_URL }} + script: | + docker pull public.ecr.aws/h7p2f6d8/ticats_ai:latest + docker-compose down + docker-compose up -d # Step 5: Log in to Amazon ECR (Elastic Container Registry) - name: Login to Amazon ECR