diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..14a11226 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +/*/**/Dockerfile linguist-generated +/*/**/docker-entrypoint.sh linguist-generated +/Dockerfile*.template linguist-language=Dockerfile diff --git a/.gitignore b/.gitignore index d548f66d..c8db931e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .jq-template.awk +.template-helper-functions.jq diff --git a/6.0/alpine3.18/Dockerfile b/6.0/alpine3.18/Dockerfile index 0b49d622..44e098d1 100644 --- a/6.0/alpine3.18/Dockerfile +++ b/6.0/alpine3.18/Dockerfile @@ -95,7 +95,9 @@ RUN set -eux; \ apk del --no-network .build-deps; \ \ redis-cli --version; \ - redis-server --version + redis-server --version; \ + \ + echo '{"spdxVersion":"SPDX-2.3","SPDXID":"SPDXRef-DOCUMENT","name":"redis-server-sbom","packages":[{"name":"redis-server","versionInfo":"6.0.20","SPDXID":"SPDXRef-Package--redis-server","externalRefs":[{"referenceCategory":"PACKAGE-MANAGER","referenceType":"purl","referenceLocator":"pkg:generic/redis-server@6.0.20?os_name=alpine&os_version=3.18"}],"licenseDeclared":"BSD-3-Clause"}]}' > /usr/local/redis.spdx.json RUN mkdir /data && chown redis:redis /data VOLUME /data diff --git a/6.0/bookworm/Dockerfile b/6.0/bookworm/Dockerfile index 8bb14991..2c486311 100644 --- a/6.0/bookworm/Dockerfile +++ b/6.0/bookworm/Dockerfile @@ -113,7 +113,9 @@ RUN set -eux; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ \ redis-cli --version; \ - redis-server --version + redis-server --version; \ + \ + echo '{"spdxVersion":"SPDX-2.3","SPDXID":"SPDXRef-DOCUMENT","name":"redis-server-sbom","packages":[{"name":"redis-server","versionInfo":"6.0.20","SPDXID":"SPDXRef-Package--redis-server","externalRefs":[{"referenceCategory":"PACKAGE-MANAGER","referenceType":"purl","referenceLocator":"pkg:generic/redis-server@6.0.20?os_name=debian&os_version=bookworm"}],"licenseDeclared":"BSD-3-Clause"}]}' > /usr/local/redis.spdx.json RUN mkdir /data && chown redis:redis /data VOLUME /data diff --git a/6.2/alpine3.18/Dockerfile b/6.2/alpine3.18/Dockerfile index 57a9d900..33b315a4 100644 --- a/6.2/alpine3.18/Dockerfile +++ b/6.2/alpine3.18/Dockerfile @@ -95,7 +95,9 @@ RUN set -eux; \ apk del --no-network .build-deps; \ \ redis-cli --version; \ - redis-server --version + redis-server --version; \ + \ + echo '{"spdxVersion":"SPDX-2.3","SPDXID":"SPDXRef-DOCUMENT","name":"redis-server-sbom","packages":[{"name":"redis-server","versionInfo":"6.2.14","SPDXID":"SPDXRef-Package--redis-server","externalRefs":[{"referenceCategory":"PACKAGE-MANAGER","referenceType":"purl","referenceLocator":"pkg:generic/redis-server@6.2.14?os_name=alpine&os_version=3.18"}],"licenseDeclared":"BSD-3-Clause"}]}' > /usr/local/redis.spdx.json RUN mkdir /data && chown redis:redis /data VOLUME /data diff --git a/6.2/bookworm/Dockerfile b/6.2/bookworm/Dockerfile index a17a1928..05bbebd0 100644 --- a/6.2/bookworm/Dockerfile +++ b/6.2/bookworm/Dockerfile @@ -113,7 +113,9 @@ RUN set -eux; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ \ redis-cli --version; \ - redis-server --version + redis-server --version; \ + \ + echo '{"spdxVersion":"SPDX-2.3","SPDXID":"SPDXRef-DOCUMENT","name":"redis-server-sbom","packages":[{"name":"redis-server","versionInfo":"6.2.14","SPDXID":"SPDXRef-Package--redis-server","externalRefs":[{"referenceCategory":"PACKAGE-MANAGER","referenceType":"purl","referenceLocator":"pkg:generic/redis-server@6.2.14?os_name=debian&os_version=bookworm"}],"licenseDeclared":"BSD-3-Clause"}]}' > /usr/local/redis.spdx.json RUN mkdir /data && chown redis:redis /data VOLUME /data diff --git a/7.0/alpine3.18/Dockerfile b/7.0/alpine3.18/Dockerfile index 678127ed..be793eed 100644 --- a/7.0/alpine3.18/Dockerfile +++ b/7.0/alpine3.18/Dockerfile @@ -95,7 +95,9 @@ RUN set -eux; \ apk del --no-network .build-deps; \ \ redis-cli --version; \ - redis-server --version + redis-server --version; \ + \ + echo '{"spdxVersion":"SPDX-2.3","SPDXID":"SPDXRef-DOCUMENT","name":"redis-server-sbom","packages":[{"name":"redis-server","versionInfo":"7.0.14","SPDXID":"SPDXRef-Package--redis-server","externalRefs":[{"referenceCategory":"PACKAGE-MANAGER","referenceType":"purl","referenceLocator":"pkg:generic/redis-server@7.0.14?os_name=alpine&os_version=3.18"}],"licenseDeclared":"BSD-3-Clause"}]}' > /usr/local/redis.spdx.json RUN mkdir /data && chown redis:redis /data VOLUME /data diff --git a/7.0/bookworm/Dockerfile b/7.0/bookworm/Dockerfile index 34a4d590..1fc5422c 100644 --- a/7.0/bookworm/Dockerfile +++ b/7.0/bookworm/Dockerfile @@ -113,7 +113,9 @@ RUN set -eux; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ \ redis-cli --version; \ - redis-server --version + redis-server --version; \ + \ + echo '{"spdxVersion":"SPDX-2.3","SPDXID":"SPDXRef-DOCUMENT","name":"redis-server-sbom","packages":[{"name":"redis-server","versionInfo":"7.0.14","SPDXID":"SPDXRef-Package--redis-server","externalRefs":[{"referenceCategory":"PACKAGE-MANAGER","referenceType":"purl","referenceLocator":"pkg:generic/redis-server@7.0.14?os_name=debian&os_version=bookworm"}],"licenseDeclared":"BSD-3-Clause"}]}' > /usr/local/redis.spdx.json RUN mkdir /data && chown redis:redis /data VOLUME /data diff --git a/7.2/alpine3.18/Dockerfile b/7.2/alpine3.18/Dockerfile index 3499ea74..cafa7665 100644 --- a/7.2/alpine3.18/Dockerfile +++ b/7.2/alpine3.18/Dockerfile @@ -95,7 +95,9 @@ RUN set -eux; \ apk del --no-network .build-deps; \ \ redis-cli --version; \ - redis-server --version + redis-server --version; \ + \ + echo '{"spdxVersion":"SPDX-2.3","SPDXID":"SPDXRef-DOCUMENT","name":"redis-server-sbom","packages":[{"name":"redis-server","versionInfo":"7.2.3","SPDXID":"SPDXRef-Package--redis-server","externalRefs":[{"referenceCategory":"PACKAGE-MANAGER","referenceType":"purl","referenceLocator":"pkg:generic/redis-server@7.2.3?os_name=alpine&os_version=3.18"}],"licenseDeclared":"BSD-3-Clause"}]}' > /usr/local/redis.spdx.json RUN mkdir /data && chown redis:redis /data VOLUME /data diff --git a/7.2/bookworm/Dockerfile b/7.2/bookworm/Dockerfile index fdefb7b3..b6cf53ea 100644 --- a/7.2/bookworm/Dockerfile +++ b/7.2/bookworm/Dockerfile @@ -113,7 +113,9 @@ RUN set -eux; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ \ redis-cli --version; \ - redis-server --version + redis-server --version; \ + \ + echo '{"spdxVersion":"SPDX-2.3","SPDXID":"SPDXRef-DOCUMENT","name":"redis-server-sbom","packages":[{"name":"redis-server","versionInfo":"7.2.3","SPDXID":"SPDXRef-Package--redis-server","externalRefs":[{"referenceCategory":"PACKAGE-MANAGER","referenceType":"purl","referenceLocator":"pkg:generic/redis-server@7.2.3?os_name=debian&os_version=bookworm"}],"licenseDeclared":"BSD-3-Clause"}]}' > /usr/local/redis.spdx.json RUN mkdir /data && chown redis:redis /data VOLUME /data diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index a9e5efa9..3c7cc7c2 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -1,3 +1,4 @@ +{{ include ".template-helper-functions" -}} FROM alpine:{{ env.variant | ltrimstr("alpine") }} # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added @@ -89,7 +90,21 @@ RUN set -eux; \ apk del --no-network .build-deps; \ \ redis-cli --version; \ - redis-server --version + redis-server --version; \ + \ + echo {{ + { + name: "redis-server", + version: .version, + params: { + os_name: "alpine", + os_version: env.variant | ltrimstr("alpine") + }, + licenses: [ + "BSD-3-Clause" + ] + } | sbom | tostring | @sh + }} > /usr/local/redis.spdx.json RUN mkdir /data && chown redis:redis /data VOLUME /data diff --git a/Dockerfile.template b/Dockerfile.template index 31f2a065..b84cfe63 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -1,3 +1,4 @@ +{{ include ".template-helper-functions" -}} FROM debian:{{ env.variant }}-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added @@ -107,7 +108,21 @@ RUN set -eux; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ \ redis-cli --version; \ - redis-server --version + redis-server --version; \ + \ + echo {{ + { + name: "redis-server", + version: .version, + params: { + os_name: "debian", + os_version: env.variant + }, + licenses: [ + "BSD-3-Clause" + ] + } | sbom | tostring | @sh + }} > /usr/local/redis.spdx.json RUN mkdir /data && chown redis:redis /data VOLUME /data diff --git a/apply-templates.sh b/apply-templates.sh index 2edf95f8..3f3b692d 100755 --- a/apply-templates.sh +++ b/apply-templates.sh @@ -13,6 +13,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/08c926140ad0af22de58c2a2656afda58082ba3e/scripts/template-helper-functions.jq' +fi + if [ "$#" -eq 0 ]; then versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" eval "set -- $versions"