From 7ec2ab2843bbfa43c8fb5003a525bcd0e4f7527e Mon Sep 17 00:00:00 2001 From: dangeunii <101170415+dangeunii@users.noreply.github.com> Date: Mon, 26 Feb 2024 16:22:59 +0900 Subject: [PATCH] Update gradle.yml --- .github/workflows/gradle.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 917f177..8fdbc41 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -83,3 +83,26 @@ jobs: # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md - name: Generate and submit dependency graph uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 + +# 위 과정에서 푸시한 이미지를 서버에서 pull 받아서 실행시키는 과정 + run-docker-image-on-gcp: + # build-docker-image (위)과정이 완료되어야 실행됩니다. + needs: build + runs-on: self-hostedd + + steps: + # 1. 최신 이미지를 풀받습니다 + - name: docker pull + run: sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/taekiteasy + + # 2. 기존의 컨테이너를 중지시킵니다 + - name: docker stop container + run: sudo docker stop $(sudo docker ps -q) 2>/dev/null || true + + # 3. 최신 이미지를 컨테이너화하여 실행시킵니다 + - name: docker run new container + run: sudo docker run --name taekiteasy --rm -d -p 9001:8080 ${{ secrets.DOCKERHUB_USERNAME }}/taekiteasy + + # 4. 미사용 이미지를 정리합니다 + - name: delete old docker image + run: sudo docker system prune -f