From 6bd0e5492f011213e04f0c8e4c420bf0783d2a64 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 28 Feb 2024 15:43:21 +0100 Subject: [PATCH] ci: local-cache job to test local cache feature Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 57 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d50206..458c4e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -942,6 +942,63 @@ jobs: run: | docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}' + local-cache: + runs-on: ubuntu-latest + services: + registry: + image: registry:2 + ports: + - 5000:5000 + steps: + - + name: Checkout + uses: actions/checkout@v4 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} + driver-opts: | + network=host + image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} + buildkitd-flags: --debug + - + name: Cache Build + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-local-test-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-local-test- + - + name: Build and push + uses: ./ + with: + context: ./test + file: ./test/multi.Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + localhost:5000/name/app:latest + localhost:5000/name/app:1.0.0 + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new + - + name: Inspect + run: | + docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}' + - + # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + standalone: runs-on: ubuntu-latest steps: