include docker provenance (#13324) (#13327)

* add provenance and attestations

* improve caching

(cherry picked from commit 78b6dd83a4)
This commit is contained in:
Matthias Mair authored and GitHub committed 2026-11-19 10:51:35 +11:00
1 parent 432d5a5ce6
commit e7b6bc352d
2 files changed
+13 -5

No files matched your search

+9 -1
View File
@@ -159,6 +159,7 @@ jobs:
contents: read contents: read
packages: write packages: write
id-token: write id-token: write
attestations: write
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
python_version: 3.12 python_version: 3.12
@@ -231,9 +232,16 @@ jobs:
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: true push: true
sbom: true sbom: true
provenance: false provenance: mode=max
target: production target: production
tags: ${{ env.docker_tags }} tags: ${{ env.docker_tags }}
build-args: | build-args: |
commit_hash=${{ env.git_commit_hash }} commit_hash=${{ env.git_commit_hash }}
commit_date=${{ env.git_commit_date }} 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
+4 -4
View File
@@ -100,10 +100,6 @@ ENTRYPOINT ["/bin/bash", "./init.sh"]
# Multi-stage build to compile project requirements # Multi-stage build to compile project requirements
FROM inventree_base AS builder_stage 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 # Install backend build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config build-essential \ pkg-config build-essential \
@@ -118,6 +114,10 @@ RUN pip install --user --require-hashes -r base_requirements.txt --no-cache-dir
pip cache purge && \ pip cache purge && \
rm -rf /root/.cache/pip rm -rf /root/.cache/pip
# Copy source files
COPY src ${INVENTREE_HOME}/src
COPY tasks.py ${INVENTREE_HOME}/tasks.py
# Install frontend build dependencies # Install frontend build dependencies
# pinned to v0.40.5 # pinned to v0.40.5
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/1889911f0841e669de0be5bd02c737a3f1fd20fa/install.sh | bash && \ RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/1889911f0841e669de0be5bd02c737a3f1fd20fa/install.sh | bash && \