Skip to content

Commit 831ca17

Browse files
authored
Merge pull request #1066 from crazy-max/ci-local-cache
ci: local-cache job to test local cache feature
2 parents b3eddbb + 6bd0e54 commit 831ca17

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/ci.yml

+57
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,63 @@ jobs:
942942
run: |
943943
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
944944
945+
local-cache:
946+
runs-on: ubuntu-latest
947+
services:
948+
registry:
949+
image: registry:2
950+
ports:
951+
- 5000:5000
952+
steps:
953+
-
954+
name: Checkout
955+
uses: actions/checkout@v4
956+
-
957+
name: Set up QEMU
958+
uses: docker/setup-qemu-action@v3
959+
-
960+
name: Set up Docker Buildx
961+
uses: docker/setup-buildx-action@v3
962+
with:
963+
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
964+
driver-opts: |
965+
network=host
966+
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
967+
buildkitd-flags: --debug
968+
-
969+
name: Cache Build
970+
uses: actions/cache@v4
971+
with:
972+
path: /tmp/.buildx-cache
973+
key: ${{ runner.os }}-local-test-${{ github.sha }}
974+
restore-keys: |
975+
${{ runner.os }}-local-test-
976+
-
977+
name: Build and push
978+
uses: ./
979+
with:
980+
context: ./test
981+
file: ./test/multi.Dockerfile
982+
platforms: linux/amd64,linux/arm64
983+
push: true
984+
tags: |
985+
localhost:5000/name/app:latest
986+
localhost:5000/name/app:1.0.0
987+
cache-from: type=local,src=/tmp/.buildx-cache
988+
cache-to: type=local,dest=/tmp/.buildx-cache-new
989+
-
990+
name: Inspect
991+
run: |
992+
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
993+
-
994+
# Temp fix
995+
# https://github.com/docker/build-push-action/issues/252
996+
# https://github.com/moby/buildkit/issues/1896
997+
name: Move cache
998+
run: |
999+
rm -rf /tmp/.buildx-cache
1000+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
1001+
9451002
standalone:
9461003
runs-on: ubuntu-latest
9471004
steps:

0 commit comments

Comments
 (0)