diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 1896c8d..50ae779 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -57,7 +57,7 @@ jobs: #작업을 정의 # 3. Docker 이미지 빌드 - name: docker image build - run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/just . + run: docker build -t 0.0.0.0:5000/${{ secrets.DOCKERHUB_USERNAME }}/just:latest . # 4. DockerHub 로그인 - name: docker login @@ -65,12 +65,10 @@ jobs: #작업을 정의 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - - name : docker tag - run: docker tag ${{ secrets.DOCKERHUB_USERNAME }}/just ${{ secrets.DOCKERHUB_USERNAME }}/just:latest # 5. Docker Hub 이미지 푸시 - name: docker Hub push - run: docker push {{ secrets.DOCKERHUB_USERNAME }}/just:latest + run: docker push 0.0.0.0:5000/${{ secrets.DOCKERHUB_USERNAME }}/just:latest # run-docker-image-on-ec2: # build-docker-image (위)과정이 완료되어야 실행됩니다. @@ -78,9 +76,11 @@ jobs: #작업을 정의 runs-on: self-hosted steps: + - name: docker rmi + run: docker rmi 0.0.0.0:5000/${{ secrets.DOCKERHUB_USERNAME }}/just:latest # 1. 최신 이미지를 풀받습니다 - name: docker pull - run: sudo docker pull {{ secrets.DOCKERHUB_USERNAME }}/just:latest + run: sudo docker pull 0.0.0.0:5000/${{ secrets.DOCKERHUB_USERNAME }}/just:latest # 2. 기존의 컨테이너를 중지시킵니다 - name: docker stop container @@ -88,9 +88,6 @@ jobs: #작업을 정의 # 3. 최신 이미지를 컨테이너화하여 실행시킵니다 - name: docker run new container - run: sudo docker run --name just --rm -d -p 9000:9000 ${{ secrets.DOCKERHUB_USERNAME }}/just:latest + run: sudo docker run 0.0.0.0:5000/${{ secrets.DOCKERHUB_USERNAME }}/just:latest - # 4. 미사용 이미지를 정리합니다 - - name: delete old docker image - run: sudo docker system prune -f