From 5b4bd6dca204519a8c325e211efe874ad688026c Mon Sep 17 00:00:00 2001 From: "TOwInOK 60252419+TOwInOK@users.noreply.github.com" <60252419+TOwInOK@users.noreply.github.com> Date: Sun, 27 Oct 2024 04:40:50 +0700 Subject: [PATCH] change cache --- .github/workflows/docker.yaml | 39 +++++++---------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 4c2bec6..2fb1797 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -46,6 +46,7 @@ jobs: - name: Run Clippy run: cargo clippy -- -D warnings + docker-build: needs: rust-checks runs-on: ubuntu-latest @@ -65,8 +66,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - with: - buildkitd-flags: --debug - name: Login to Container Registry uses: docker/login-action@v3 @@ -75,15 +74,6 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - # Restore cache - - name: Cache Docker layers - uses: actions/cache@v3 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - name: Generate Docker metadata id: meta uses: docker/metadata-action@v5 @@ -93,12 +83,12 @@ jobs: type=raw,value=latest type=sha,format=short labels: | - org.opencontainers.image.title=Shuller Bot - org.opencontainers.image.description=Discord Bot + org.opencontainers.image.title=luuma + org.opencontainers.image.description=Anime picture fetcher bot org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} maintainer=towinok - - name: Build and push + - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . @@ -106,27 +96,14 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: linux/amd64 - cache-from: | - type=local,src=/tmp/.buildx-cache - type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache - cache-to: | - type=local,dest=/tmp/.buildx-cache-new,mode=max - type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max - outputs: | - type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - # Временный фикс для кэша - - name: Move cache - if: always() - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache + cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max - - name: Check image + - name: Verify Docker image if: success() run: | docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest - docker image ls ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + docker image inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest # deploy: # needs: docker-build # runs-on: ubuntu-latest