From 691bdf85a2864a87248420fc45c26772d83844e3 Mon Sep 17 00:00:00 2001 From: sudacode Date: Wed, 5 Feb 2025 00:09:49 -0800 Subject: [PATCH] update docker image workflow - add cache - add step to send webhook to rebuild container --- .github/workflows/docker-image.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index c8687e32..9fb2ad3f 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -31,9 +31,6 @@ jobs: id: buildx uses: docker/setup-buildx-action@v2 - # - name: Log in to Gitea Docker Registry - # run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login https://gitea.suda.codes -u ${{ secrets.DOCKER_USERNAME }} --password-stdin - - name: Login to DockerHub if: github.event_name != 'pull_request' uses: docker/login-action@v2 @@ -52,3 +49,21 @@ jobs: tags: | gitea.suda.codes/sudacode/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }} gitea.suda.codes/sudacode/${{ steps.meta.outputs.REPO_NAME }}:latest + cache-from: type=local,src=${{ runner.temp }}/.buildx-cache + cache-to: type=local,dest=${{ runner.temp }}/.buildx-cache-new,mode=max + + - # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + name: Move cache + run: | + rm -rf ${{ runner.temp }}/.buildx-cache + mv ${{ runner.temp }}/.buildx-cache-new ${{ runner.temp }}/.buildx-cache + + - name: Invoke deployment hook + uses: distributhor/workflow-webhook@v3 + with: + webhook_url: ${{ secrets.WEBHOOK_URL }} + webhook_auth: ${{ secrets.WEBHOOK_AUTH }} + webhook_secret: ${{ secrets.WEBHOOK_SECRET }} + webhook_auth_type: bearer