From 3720bce5b102a19e717ca497bd7399fc6593c102 Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Wed, 8 May 2024 10:52:59 +0200 Subject: [PATCH] Check caching --- .github/workflows/ci.yml | 15 +++++---------- .github/workflows/env.hcl | 2 +- docker-bake.hcl | 5 ++++- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d65676..d051e33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,8 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + + - uses: crazy-max/ghaction-github-runtime@v3 - name: Build and upload to ghcr.io 📤 id: build-upload uses: docker/bake-action@v4 @@ -59,21 +61,14 @@ jobs: set: | *.platform=linux/amd64 *.output=type=registry,push-by-digest=true,name-canonical=true - *.cache-from=type=local,src=/tmp/.buildx-cache - *.cache-to=type=local,mode=max,dest=/tmp/.buildx-cache-new + *.cache-from=type=gha + *.cache-to=type=gha,mode=max + files: | docker-bake.hcl build.json .github/workflows/env.hcl - # Temp fix for issue of fast size grow in local caching: - # 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 - - name: Set output variables id: bake_metadata run: | diff --git a/.github/workflows/env.hcl b/.github/workflows/env.hcl index eea8766..c5b87d5 100644 --- a/.github/workflows/env.hcl +++ b/.github/workflows/env.hcl @@ -1,2 +1,2 @@ # env.hcl -REGISTRY = "ghcr.io/" \ No newline at end of file +REGISTRY = "ghcr.io" \ No newline at end of file diff --git a/docker-bake.hcl b/docker-bake.hcl index 39267d2..eca228a 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -18,8 +18,11 @@ variable "GNU_COMPILER_VERSION" { variable "LAPACK_VERSION" { } +variable "REGISTRY" { +} + target "base" { - tags = ["${ORGANIZATION}/build-machine:latest"] + tags = ["${REGISTRY}/${ORGANIZATION}/build-machine:latest"] context = "." contexts = { base-image = "docker-image://${BASE_IMAGE}"