From f15e3e56e51708a4ace8b09f78c57fe841e55770 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Sat, 17 Jun 2023 09:11:00 +0000 Subject: [PATCH 1/2] chore(ci): Docker base image layers caching - Cache base image layers only - Cache for verify job only - Do not cache for publish job since: - most of the work is cross compiling - go.mod often change between publish jobs - prevent bugs introduced due to the cache (unlikely) --- .github/workflows/build.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 74957608f..0fef83bc9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,32 @@ jobs: locale: "US" level: error + - uses: docker/setup-buildx-action@v2 + + - uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Build and cache base image layers + uses: docker/build-push-action@v4 + with: + target: base + load: true + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.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 + if: always() + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + - name: Linting run: docker build --target lint . From c7f11b9a23916dbd4ebbd1a5ebc4f43fdc8e465d Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Sat, 17 Jun 2023 14:31:15 +0000 Subject: [PATCH 2/2] try --- .github/workflows/build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0fef83bc9..b2e8ee666 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,8 +58,13 @@ jobs: with: target: base load: true + outputs: type=docker + build-args: | + BUILDKIT_INLINE_CACHE=1 cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + cache-to: | + type=local,dest=/tmp/.buildx-cache-new,mode=max + type=inline # Temp fix # https://github.com/docker/build-push-action/issues/252