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 Nov 9, 2023
1 parent 62c197f commit 686bf29
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 8 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
12 changes: 9 additions & 3 deletions 24/cli/Dockerfile

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

4 changes: 4 additions & 0 deletions 24/dind-rootless/Dockerfile

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

5 changes: 4 additions & 1 deletion 24/dind/Dockerfile

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

37 changes: 34 additions & 3 deletions Dockerfile-cli.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ include "shared" -}}
FROM alpine:3.18
{{ include ".template-helper-functions" -}}
FROM alpine:{{ .alpine }}

RUN apk add --no-cache \
ca-certificates \
Expand Down Expand Up @@ -34,7 +35,22 @@ RUN set -eux; \
; \
rm docker.tgz; \
\
docker --version
docker --version; \
\
echo {{
{
name: "docker",
version: .version,
supplier: "Organization: Docker, Inc",
params: {
os_name: "alpine",
os_version: .alpine
},
licenses: [
"Apache-2.0"
]
} | sbom | tostring | @sh
}} > /usr/local/docker.spdx.json ;
{{
{
buildx: .buildx,
Expand Down Expand Up @@ -66,7 +82,22 @@ RUN set -eux; \
ln -sv "$plugin" /usr/local/bin/; \
docker-{{ $key }} --version; \
{{ ) else "" end -}}
docker {{ $key }} version
docker {{ $key }} version; \
\
echo {{
{
name: $key,
version: .version,
supplier: "Organization: Docker, Inc",
params: {
os_name: "alpine",
os_version: "3.18"
},
licenses: [
"Apache-2.0"
]
} | sbom | tostring | @sh
}} > /usr/local/docker-{{ $key }}.spdx.json ;
{{
)
)
Expand Down
4 changes: 4 additions & 0 deletions Dockerfile-dind-rootless.template
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ RUN set -eux; \
; \
rm rootless.tgz; \
\
dockerd --version; \
containerd --version; \
ctr --version; \
runc --version; \
rootlesskit --version; \
vpnkit --version

Expand Down
18 changes: 17 additions & 1 deletion Dockerfile-dind.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ include "shared" -}}
{{ include ".template-helper-functions" -}}
FROM docker:{{ env.version }}-cli

# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies
Expand Down Expand Up @@ -56,7 +57,22 @@ RUN set -eux; \
dockerd --version; \
containerd --version; \
ctr --version; \
runc --version
runc --version; \
{{ .version as $version | ["dockerd", "docker-init", "docker-proxy"] | map( . as $binary | ( -}}
echo {{
{
name: $binary,
version: $version,
supplier: "Organization: Docker, Inc",
params: {
os_name: "alpine",
os_version: "3.18"
},
licenses: [
"Apache-2.0"
]
} | sbom | tostring | @sh
}} > /usr/local/{{ $binary }}.spdx.json; {{ )) | join("\\\n") }}

# https://github.com/docker/docker/tree/master/hack/dind
ENV DIND_COMMIT {{ .dindCommit }}
Expand Down
7 changes: 7 additions & 0 deletions apply-templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ 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 [ -n "${BASHBREW_SCRIPTS:-}" ]; then
jqf="$BASHBREW_SCRIPTS/template-helper-functions.jq"
elif [ "$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
1 change: 1 addition & 0 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"24": {
"alpine": "3.18",
"arches": {
"amd64": {
"dockerUrl": "https://download.docker.com/linux/static/stable/x86_64/docker-24.0.7.tgz",
Expand Down
4 changes: 4 additions & 0 deletions versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ declare -A dockerArches=(

cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"

defaultAlpine='3.18'

versions=( "$@" )
if [ ${#versions[@]} -eq 0 ]; then
versions=( */ )
Expand Down Expand Up @@ -203,9 +205,11 @@ for version in "${versions[@]}"; do
echo "$version: $fullVersion (buildx $buildxVersion, compose $composeVersion)"

export fullVersion dindLatest
export defaultAlpine
doc="$(
jq -nc --argjson buildx "$buildx" --argjson compose "$compose" '{
version: env.fullVersion,
alpine: env.defaultAlpine,
arches: {},
dindCommit: env.dindLatest,
buildx: $buildx,
Expand Down

0 comments on commit 686bf29

Please sign in to comment.