From c51a77b676bd6c52747a2a20b7f03212d4b0cbb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B1=84=ED=99=8D=EB=AC=B4?= <92268965+Hong-Mu@users.noreply.github.com> Date: Mon, 6 May 2024 17:56:45 +0900 Subject: [PATCH] Update deploy-docker.yml --- .github/workflows/deploy-docker.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-docker.yml b/.github/workflows/deploy-docker.yml index 7786f9f..a1bcfe3 100644 --- a/.github/workflows/deploy-docker.yml +++ b/.github/workflows/deploy-docker.yml @@ -60,10 +60,13 @@ jobs: username: ${{ secrets.EC2_USERNAME }} key: ${{ secrets.EC2_PEM }} script: | + sudo aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY }} && \ + sudo aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_KEY }} && \ + sudo aws configure set default_region ap-northeast-2 && \ + sudo aws configure set output json sudo aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin $ECR_REGISTRY sudo docker stop server sudo docker rm server ; - sudo docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} - sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_IMAGENAME }} - sudo docker run --name=server -d -p 80:5000 --restart=always ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_IMAGENAME }} + sudo docker pull $ECR_REGISTRY/${{ secrets.DOCKER_IMAGENAME }} + sudo docker run --name=server -d -p 80:5000 --restart=always $ECR_REGISTRY/${{ secrets.DOCKER_IMAGENAME }} sudo docker image prune -f