Skip to content

Commit

Permalink
Added inline SBOM for binaries downloaded outside package manager
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentGoderre committed Oct 3, 2023
1 parent c0e8bf9 commit f23c559
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.jq-template.awk
template-helper-functions.jq
7 changes: 6 additions & 1 deletion 24/cli/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 30 additions & 1 deletion Dockerfile-cli.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ include "shared" -}}
{{ include "template-helper-functions" }}
FROM alpine:3.18

RUN apk add --no-cache \
Expand Down Expand Up @@ -34,7 +35,21 @@ RUN set -eux; \
; \
rm docker.tgz; \
\
docker --version
docker --version; \
\
echo '{{
{
name: "docker",
version: .version,
params: {
os_name: "alpine",
os_version: "3.18"
},
licenses: [
"Apache-2.0"
]
} | sbom | tostring
}}' > /usr/local/bin/docker.spdx.json ;
{{
{
buildx: .buildx,
Expand Down Expand Up @@ -65,6 +80,20 @@ RUN set -eux; \
{{ if $key == "compose" then ( -}}
ln -sv "$plugin" /usr/local/bin/; \
docker-{{ $key }} --version; \
\
echo '{{
{
name: ("docker-" + $key),
version: .version,
params: {
os_name: "alpine",
os_version: "3.18"
},
licenses: [
"Apache-2.0"
]
} | sbom | tostring
}}' > /usr/local/bin/docker-{{ $key }}.spdx.json ; \
{{ ) else "" end -}}
docker {{ $key }} version
{{
Expand Down
5 changes: 5 additions & 0 deletions apply-templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ elif [ "$BASH_SOURCE" -nt "$jqt" ]; then
wget -qO "$jqt" 'https://github.com/docker-library/bashbrew/raw/9f6a35772ac863a0241f147c820354e4008edf38/scripts/jq-template.awk'
fi

jqf='template-helper-functions.jq'
if [ "$BASH_SOURCE" -nt "$jqf" ]; then
wget -qO "$jqf" 'https://github.com/docker-library/bashbrew/raw/master/scripts/template-helper-functions.jq'
fi

if [ "$#" -eq 0 ]; then
versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)"
eval "set -- $versions"
Expand Down

0 comments on commit f23c559

Please sign in to comment.