From 78b6dd83a4979a74e3d4bc7d5f779992d000f7b4 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Wed, 18 Nov 2026 22:51:46 +0100 Subject: [PATCH] include docker provenance (#13324) * add provenance and attestations * improve caching --- .github/workflows/docker.yaml | 10 +++++++++- contrib/container/Dockerfile | 8 ++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index d3b22a17e4..9d646336ba 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -159,6 +159,7 @@ jobs: contents: read packages: write id-token: write + attestations: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} python_version: 3.12 @@ -231,9 +232,16 @@ jobs: platforms: linux/amd64,linux/arm64 push: true sbom: true - provenance: false + provenance: mode=max target: production tags: ${{ env.docker_tags }} build-args: | commit_hash=${{ env.git_commit_hash }} commit_date=${{ env.git_commit_date }} + - name: Attest build provenance (GHCR) + if: github.event_name != 'pull_request' + uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 + with: + subject-name: ghcr.io/inventree/inventree + subject-digest: ${{ steps.push-docker.outputs.digest }} + push-to-registry: true diff --git a/contrib/container/Dockerfile b/contrib/container/Dockerfile index 1961d34510..cc66e0f5b9 100644 --- a/contrib/container/Dockerfile +++ b/contrib/container/Dockerfile @@ -100,10 +100,6 @@ ENTRYPOINT ["/bin/bash", "./init.sh"] # Multi-stage build to compile project requirements FROM inventree_base AS builder_stage -# Copy source files -COPY src ${INVENTREE_HOME}/src -COPY tasks.py ${INVENTREE_HOME}/tasks.py - # Install backend build dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ pkg-config build-essential \ @@ -118,6 +114,10 @@ RUN pip install --user --require-hashes -r base_requirements.txt --no-cache-dir pip cache purge && \ rm -rf /root/.cache/pip +# Copy source files +COPY src ${INVENTREE_HOME}/src +COPY tasks.py ${INVENTREE_HOME}/tasks.py + # Install frontend build dependencies # pinned to v0.40.5 RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/1889911f0841e669de0be5bd02c737a3f1fd20fa/install.sh | bash && \