Skip to content

Commit

Permalink
fix: main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
tomatoziyun committed Oct 23, 2023
1 parent 174ac6f commit 10b7cbc
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,27 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2

- name: Access to AWS EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_HOST }}
username: ${{ secrets.AWS_USERNAME }}
key: ${{ secrets.AWS_PRIVATE_KEY }}
# - name: Access to AWS EC2
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.AWS_HOST }}
# username: ${{ secrets.AWS_USERNAME }}
# key: ${{ secrets.AWS_PRIVATE_KEY }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Pull image from Amazon ECR and restart container
run: |
cd ~/api-gateway
docker pull ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker stop test_con && docker rm test_con
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

0 comments on commit 10b7cbc

Please sign in to comment.