Skip to content

Commit afe074f

Browse files
committed
Handle sbom deltas
1 parent 670071c commit afe074f

14 files changed

Lines changed: 689 additions & 7 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Generate SBOM Delta
2+
description: Install Syft, generate delta SBOM for a container, and upload the artifact.
3+
4+
inputs:
5+
container:
6+
description: Container name to scan
7+
required: true
8+
version:
9+
description: Image tag or version
10+
required: true
11+
registry:
12+
description: Registry prefix (e.g. ghcr.io/org/)
13+
required: true
14+
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Install syft
19+
shell: bash
20+
run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
21+
22+
- name: Install task
23+
shell: bash
24+
run: which task || curl -sSfL https://taskfile.dev/install.sh | sh -s -- -b /usr/local/bin
25+
26+
- name: Generate delta SBOM
27+
shell: bash
28+
env:
29+
CONTAINER: ${{ inputs.container }}
30+
VERSION: ${{ inputs.version }}
31+
REGISTRY: ${{ inputs.registry }}
32+
run: |
33+
task -t Taskfile.dist.yml sbom:delta -- \
34+
--version "$VERSION" \
35+
--registry "$REGISTRY" \
36+
"$CONTAINER"
37+
38+
- name: Upload delta SBOM artifacts
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: sbom-delta-${{ inputs.container }}
42+
path: ./containers/${{ inputs.container }}/sbom-delta/

.github/workflows/docker-build.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ jobs:
210210
REGISTRY=${{ env.DEV_REGISTRY_PATH }}
211211
BASE_IMAGE_VERSION=${{ needs.setup.outputs.image_tag }}
212212
213+
- name: SBOM Delta
214+
uses: ./.github/actions/sbom-delta
215+
with:
216+
container: ${{ matrix.container }}
217+
version: ${{ needs.setup.outputs.image_tag }}
218+
registry: ${{ env.DEV_REGISTRY_PATH }}
219+
213220
build-downstream:
214221
needs: [ setup, build ]
215222
if: needs.setup.outputs.downstream_containers != '[]'
@@ -302,3 +309,10 @@ jobs:
302309
build-args: |
303310
REGISTRY=${{ env.DEV_REGISTRY_PATH }}
304311
BASE_IMAGE_VERSION=${{ needs.setup.outputs.image_tag }}
312+
313+
- name: SBOM Delta
314+
uses: ./.github/actions/sbom-delta
315+
with:
316+
container: ${{ matrix.container }}
317+
version: ${{ needs.setup.outputs.image_tag }}
318+
registry: ${{ env.DEV_REGISTRY_PATH }}

.github/workflows/docker-publish.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,13 @@ jobs:
261261
provenance: false
262262
build-args: ${{ steps.config.outputs.build_args }}
263263

264+
- name: SBOM Delta
265+
uses: ./.github/actions/sbom-delta
266+
with:
267+
container: ${{ matrix.container }}
268+
version: ${{ needs.detect.outputs.version }}
269+
registry: ${{ env.GHCR_DESTINATION_ORG }}
270+
264271
- name: Update compose file references
265272
if: steps.config.outputs.update_compose == 'true'
266273
env:
@@ -364,6 +371,13 @@ jobs:
364371
BASE_IMAGE_VERSION=${{ needs.detect.outputs.version }}
365372
REGISTRY=${{ env.GHCR_DESTINATION_ORG }}/
366373
374+
- name: SBOM Delta
375+
uses: ./.github/actions/sbom-delta
376+
with:
377+
container: ${{ matrix.container }}
378+
version: ${{ needs.detect.outputs.version }}
379+
registry: ${{ env.GHCR_DESTINATION_ORG }}
380+
367381
- name: Update compose file references
368382
if: steps.config.outputs.update_compose == 'true'
369383
env:

Taskfile.dist.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ tasks:
7676
desc: Format code
7777
cmds:
7878
- ruff format
79-
79+
8080
build-dev:
8181
desc: Build a development package
8282
cmds:
@@ -253,3 +253,8 @@ tasks:
253253
IMAGE: 'public.ecr.aws/arduino/app-bricks/ei-models-runner'
254254
TAG: '{{.EI_TAG}}'
255255
DIR: './containers/ei-models-runner'
256+
257+
sbom:delta:
258+
desc: Generate delta SBOMs for containers (requires syft and registry access)
259+
cmds:
260+
- python3 ./scripts/sbom_delta.py {{.CLI_ARGS}}

containers/aihub-models-runner/ci.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@
55
"build_whl": false,
66
"update_compose": false,
77
"build_args": {},
8+
"sbom": {
9+
"runtime_base": "ubuntu:24.04"
10+
},
811
"downstream": ["gesture-recognition-runner"]
912
}

containers/ei-models-runner/ci.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44
"tag_latest": false,
55
"build_whl": false,
66
"update_compose": true,
7-
"build_args": {}
7+
"build_args": {},
8+
"sbom": {
9+
"runtime_base": "public.ecr.aws/g7a8t7v6/inference-container:v1.92.3"
10+
}
811
}

containers/ei-qnn-models-runner/ci.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44
"tag_latest": false,
55
"build_whl": false,
66
"update_compose": true,
7-
"build_args": {}
7+
"build_args": {},
8+
"sbom": {
9+
"runtime_base": "public.ecr.aws/z9b3d4t5/inference-container-qnn:v1.92.19-test-f19ce2e7"
10+
}
811
}

containers/gesture-recognition-runner/ci.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@
55
"build_whl": false,
66
"update_compose": true,
77
"build_args": {},
8+
"sbom": {
9+
"runtime_base": "${REGISTRY}app-bricks/aihub-models-runner:${BASE_IMAGE_VERSION}"
10+
},
811
"downstream": []
912
}

containers/python-apps-base/ci.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@
99
"tag_latest": false,
1010
"build_whl": true,
1111
"update_compose": false,
12-
"build_args": { }
12+
"build_args": { },
13+
"sbom": {
14+
"runtime_base": "${REGISTRY}app-bricks/python-base:${BASE_IMAGE_VERSION}"
15+
}
1316
}

containers/python-base/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ RUN set -ex; \
2222
echo "https://github.com/${OPENCV_REPO_OWNER}/app-bricks-py/releases/download/opencv/${OPENCV_VERSION}/opencv_python_headless-${OPENCV_VERSION}-${PYTHON_VERSION}-${PYTHON_VERSION}-linux_aarch64.whl" >> /app/requirements.txt; \
2323
# Install Python dependencies
2424
pip install --no-cache-dir uv; \
25-
uv pip install --system --no-cache-dir -r /app/requirements.txt && rm /app/requirements.txt; \
25+
uv pip install --system --no-cache-dir -r /app/requirements.txt; \
26+
rm /app/requirements.txt; \
2627
# Strip debug symbols, tests and remove unneeded packages to reduce size
2728
find /usr/local/lib/python3.13/site-packages -type f -name "*.so" -exec strip -s {} +; \
2829
find /usr/local/lib/python3.13/site-packages -type f -name "*.so.*" -exec strip -s {} +; \
@@ -74,12 +75,13 @@ RUN set -ex; \
7475
rm -rf /var/lib/apt/lists/*; \
7576
rm -fr /var/cache/apt/archives/*.deb \
7677
/var/cache/apt/archives/partial/*.deb \
77-
/usr/share/doc/* \
7878
/usr/share/man/* \
7979
/usr/share/locale/* \
8080
/var/cache/debconf/* \
81-
/var/lib/dpkg/info/* \
81+
/var/lib/dpkg/info/* \
8282
/var/cache/apt/*.bin; \
83+
find /usr/share/doc -type f ! -name 'copyright' -delete; \
84+
find /usr/share/doc -type d -empty -delete; \
8385
# precompile python files to .pyc to speed up startup time
8486
python -m compileall /usr/local/bin; \
8587
python -m compileall /usr/local/lib

0 commit comments

Comments
 (0)