Skip to content

Commit

Permalink
Update deploy-docker.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Hong-Mu authored May 6, 2024
1 parent 5c7b0d0 commit 317e873
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_IMAGENAME }} .
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_IMAGENAME }}

- name: Connect to EC2 and run docker
uses: appleboy/ssh-action@master
Expand All @@ -60,9 +60,9 @@ jobs:
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PEM }}
script: |
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

0 comments on commit 317e873

Please sign in to comment.