From cccabc34cee4681e9b4cb5120fa02a6e05dbc742 Mon Sep 17 00:00:00 2001
From: jiyun <tomatoziyun@gmail.com>
Date: Mon, 23 Oct 2023 14:35:01 +0900
Subject: [PATCH] =?UTF-8?q?fix:=20main.yml=20=EC=88=9C=EC=84=9C=20?=
 =?UTF-8?q?=EB=B0=94=EA=BE=B8=EA=B8=B0,=20cd=20=EB=8B=A8=EA=B3=84=20?=
 =?UTF-8?q?=EB=B6=84=EB=A6=AC,=20build=EC=8B=9C=20=ED=94=8C=EB=9E=AB?=
 =?UTF-8?q?=ED=8F=BC=20=EC=A7=80=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .github/workflows/main.yml | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 00f7647..b0c4156 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -49,7 +49,7 @@ jobs:
           # docker buildx create --use --name multi-arch-builder
         # docker buildx build -t ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/${{ secrets.ECR_REPOSITORY }}:${{ secrets.ECR_IMAGE_TAG }} --platform linux/arm64 . --push
         run: |
-          docker build -t ${{ secrets.ECR_REGISTRY }}/${{ secrets.ECR_REPOSITORY }}:${{ secrets.ECR_IMAGE_TAG }} .
+          docker build --platform linux/arm64/v8 -t ${{ secrets.ECR_REGISTRY }}/${{ secrets.ECR_REPOSITORY }}:${{ secrets.ECR_IMAGE_TAG }} .
           docker push ${{ secrets.ECR_REGISTRY }}/${{ secrets.ECR_REPOSITORY }}:${{ secrets.ECR_IMAGE_TAG }}
 
   deploy:
@@ -77,16 +77,16 @@ jobs:
         id: login-ecr
         uses: aws-actions/amazon-ecr-login@v1
 
-      - name: Pull image from Amazon ECR and restart container
+      - name: Stop and Delete container
         run: |
           cd ~/api-gateway
+          docker-compose down --rmi all
+          docker volume rm $(docker volume ls -q)
+
+      - name: Pull image from Amazon ECR
+        run: |
           docker pull ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
-          docker-compose -f docker-compose.yml down
-          docker stop $(docker ps -qa) 2>/dev/null
-          docker rm $(docker ps -qa) 2>/dev/null
-          docker rmi -f $(docker images -qa) 2>/dev/null
-          docker volume rm $(docker volume ls -q) 2>/dev/null
-          docker network rm $(docker network ls -q) 2>/dev/null
-          docker system prune -a --volume 2>/dev/null
-          docker system prune -a --force 2>/dev/null
-          docker-compose up -d
+
+      - name: Restart container
+        run: |
+          docker-compose up -d
\ No newline at end of file