From 7b4afe864f18ce7fbf832947c7b424246d37a5d3 Mon Sep 17 00:00:00 2001 From: "ekin.tertemiz" Date: Wed, 14 Oct 2026 15:03:05 +0200 Subject: [PATCH] add local cache --- action.yaml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index 4237479..5c22c8e 100644 --- a/action.yaml +++ b/action.yaml @@ -31,18 +31,36 @@ inputs: build_args: description: 'Optional build arguments separated by spaces or newlines (e.g., KEY=VAL)' required: false - default: '' + default: '' + multi_stage_caching: + description: 'Enforce cache elision feature flags at the binary execution layer' + required: false + default: 'true' runs: using: 'composite' steps: + - name: Cache Kaniko Layers Locally + uses: actions/cache@v4 + with: + path: ${{ forgejo.workspace }}/.kaniko-local-cache + key: kaniko-cache-${{ hashFiles('**/composer.lock', '**/Dockerfile') }} + restore-keys: | + kaniko-cache- + - name: Build and Push with Kaniko shell: sh env: INPUT_BUILD_ARGS: ${{ inputs.build_args }} run: | + # 0. Enforce cache elision feature flags at the binary execution layer + export FF_KANIKO_SKIP_CACHED_STAGES=true + export FF_KANIKO_INFER_CROSS_STAGE_CACHE_KEY=true + export FF_KANIKO_CACHE_LOOKAHEAD=true + export FF_KANIKO_ROLLING_CACHE_KEY=true + # 1. Initialize Kaniko Docker config directory mkdir -p /kaniko/.docker @@ -78,4 +96,5 @@ runs: --cache=true \ --use-new-run=true \ --snapshot-mode=redo \ + --cache-dir="${{ forgejo.workspace }}/.kaniko-local-cache" --cache-repo="$CACHE_REPO_ARG" \ No newline at end of file