From d55023c50a6b6a9534ca61a15bf754989d154614 Mon Sep 17 00:00:00 2001 From: Sergey Shorokhov Date: Sun, 31 Mar 2024 23:43:02 +0300 Subject: [PATCH 1/2] Add Docker CI cache --- .github/workflows/CI.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1143748..fa19c53 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -34,6 +34,14 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.2.0 + - name: Cache Docker layers + uses: actions/cache@v4.0.2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Log in to Docker Hub if: github.ref == 'refs/heads/master' uses: docker/login-action@v3.1.0 @@ -49,4 +57,6 @@ jobs: platforms: ${{ env.DOCKER_PLATFORMS }} push: ${{ github.ref == 'refs/heads/master' }} tags: ${{ env.DOCKER_IMAGE }}:${{ matrix.branch }} - build-args: ${{ matrix.build-args }} \ No newline at end of file + build-args: ${{ matrix.build-args }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache \ No newline at end of file From 0cec78e19ada0054cd747f3ca0f67823e453a946 Mon Sep 17 00:00:00 2001 From: Sergey Shorokhov Date: Sun, 31 Mar 2024 23:52:59 +0300 Subject: [PATCH 2/2] fix: cache keys add matrix values --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index fa19c53..ed5074e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -38,9 +38,9 @@ jobs: uses: actions/cache@v4.0.2 with: path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} + key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.branch }} restore-keys: | - ${{ runner.os }}-buildx- + ${{ runner.os }}-buildx-${{ matrix.branch }} - name: Log in to Docker Hub if: github.ref == 'refs/heads/master'