diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index a47fffd6..56c5cdf2 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -83,9 +83,11 @@ jobs: file: ${{ env.DOCKERFILE }} outputs: type=image,name=${{ env.REGISTRY }}/${{ inputs.image_name }},push-by-digest=true,name-canonical=true,push=true cache-from: | - type=registry,ref=${{ env.REGISTRY }}/${{ inputs.image_name }}:buildcache-${{ env.PLATFORM_PAIR }}-${{ inputs.tag }} + type=registry,ref=${{ env.REGISTRY }}/${{ inputs.image_name }}:buildcache-${{ env.PLATFORM_PAIR }} + type=gha,scope=${{ github.workflow }} cache-to: | - type=registry,ref=${{ env.REGISTRY }}/${{ inputs.image_name }}:buildcache-${{ env.PLATFORM_PAIR }}-${{ inputs.tag }},mode=max + type=registry,ref=${{ env.REGISTRY }}/${{ inputs.image_name }}:buildcache-${{ env.PLATFORM_PAIR }},mode=max + type=gha,scope=${{ github.workflow }},mode=max build-args: | VERSION=${{ github.ref_name }} MAKE_ARGS=${{ env.MAKE_ARGS }} diff --git a/Dockerfile b/Dockerfile index fc40ea5b..6e958848 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,9 @@ ENV MAKE_ARGS=${MAKE_ARGS} ENV GOCACHE=/root/.cache/go-build ENV GOPATH=/root/go -RUN make ${MAKE_ARGS} docker=1 build +RUN --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/root/go/pkg/mod \ + make ${MAKE_ARGS} docker=1 build # Stage 3: Final image FROM scratch