Skip to content

Commit

Permalink
[BE] refactor: ssh actions port 추가 (#24)
Browse files Browse the repository at this point in the history
Signed-off-by: EunJiJung <[email protected]>
  • Loading branch information
bianbbc87 committed Feb 9, 2025
1 parent 96974bc commit fa6956f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions .github/actions/ecr-push/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,17 @@ runs:
echo "Build & Push completed!"
- name: EC2에서 ECR에 로그인하기
uses: actions/checkout@v3
uses: appleboy/ssh-action@master
with:
host: ${{ inputs.ec2_ip }}
username: ${{ inputs.ec2_username }}
key: ${{ inputs.ec2_ssh_key }}
port: 22
script: |
aws ecr get-login-password --region ${{ inputs.aws_region }} | sudo docker login --username AWS --password-stdin ${{ inputs.ecr_uri }}
- name: 기존 EC2에서 실행중인 컨테이너 종료
uses: actions/checkout@v3
uses: appleboy/ssh-action@master
with:
host: ${{ inputs.ec2_ip }}
username: ${{ inputs.ec2_username }}
Expand All @@ -102,7 +103,7 @@ runs:
sudo docker ps -q | xargs -r docker stop
- name: 기존 EC2에 존재하는 모든 컨테이너 삭제
uses: actions/checkout@v3
uses: appleboy/ssh-action@master
with:
host: ${{ inputs.ec2_ip }}
username: ${{ inputs.ec2_username }}
Expand All @@ -111,7 +112,7 @@ runs:
sudo docker ps -asq | xargs -r docker rm
- name: 기존 EC2에 저장되어있는 이미지 삭제
uses: actions/checkout@v3
uses: appleboy/ssh-action@master
with:
host: ${{ inputs.ec2_ip }}
username: ${{ inputs.ec2_username }}
Expand All @@ -120,7 +121,7 @@ runs:
sudo docker images -q | xargs -r docker rmi
- name: EC2에서 도커에서 사용하지 않는 자원 삭제처리
uses: actions/checkout@v3
uses: appleboy/ssh-action@master
with:
host: ${{ inputs.ec2_ip }}
username: ${{ inputs.ec2_username }}
Expand All @@ -129,7 +130,7 @@ runs:
sudo docker system prune -af
- name: EC2에서 도커 이미지를 가져오기
uses: actions/checkout@v3
uses: appleboy/ssh-action@master
with:
host: ${{ inputs.ec2_ip }}
username: ${{ inputs.ec2_username }}
Expand All @@ -138,7 +139,7 @@ runs:
sudo docker pull ${{ inputs.ecr_uri }}/${{ inputs.namespace }}/${{ inputs.ecr_repo }}:${{ github.sha }}
- name: ECR에서 불러온 이미지를 도커에서 실행
uses: actions/checkout@v3
uses: appleboy/ssh-action@master
with:
host: ${{ inputs.ec2_ip }}
username: ${{ inputs.ec2_username }}
Expand Down

0 comments on commit fa6956f

Please sign in to comment.