From 0c07682a93abf3b76156fb3b9e1457ec7971e280 Mon Sep 17 00:00:00 2001 From: Julian Psotta Date: Mon, 25 Nov 2024 22:13:53 +0100 Subject: [PATCH] ci(grype): Add missing layer cache for grype --- .github/workflows/vulnerability-scanning.yml | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/vulnerability-scanning.yml b/.github/workflows/vulnerability-scanning.yml index bc979ee450..a54389def8 100644 --- a/.github/workflows/vulnerability-scanning.yml +++ b/.github/workflows/vulnerability-scanning.yml @@ -110,6 +110,30 @@ jobs: id: buildx with: install: true + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + - name: Cache Maven packages + uses: actions/cache@v4 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Prepare the maven cache dependencies + run: | + echo "Sync the maven dependencies" + mvn package -Dmaven.test.skip=true -B dependency:go-offline dependency:resolve-plugins dependency:resolve -q + # Replace all RUN mvn with RUN --mount=type=cache,target=/root/.m2 mvn + sed -i 's/RUN mvn /RUN --mount=type=cache,target=\/root\/.m2 mvn /g' Dockerfile + - name: inject maven-build-cache into docker + uses: reproducible-containers/buildkit-cache-dance@v3.1.2 + with: + cache-map: | + { + "/home/runner/.m2": "/root/.m2" + } - name: Build image for ${{ matrix.platform }} uses: docker/build-push-action@v4 with: