Skip to content

Commit

Permalink
fix: main.yml 순서 바꾸기, cd 단계 분리, build시 플랫폼 지정
Browse files Browse the repository at this point in the history
  • Loading branch information
tomatoziyun committed Oct 23, 2023
1 parent 10b7cbc commit cccabc3
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

0 comments on commit cccabc3

Please sign in to comment.