From 9485550baa16b126165d6d7b18dfc5bb84390e59 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 13 Sep 2019 12:56:07 -0700 Subject: [PATCH] Adjust "repo:" text ordering to more explicitly recommend "-suite" variants > ## `ruby:` > > This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of. > > Some of these tags may have names like buster or stretch in them. These are the suite code names for releases of [Debian](https://wiki.debian.org/DebianReleases) and indicate which release the image is based on. If your image needs to install any additional packages beyond what comes with the image, you'll likely want to specify one of these explicitly to minimize breakage when there are new releases of Debian. > > This tag is based off of [`buildpack-deps`](https://hub.docker.com/_/buildpack-deps/). `buildpack-deps` is designed for the average user of Docker who has many images on their system. It, by design, has a large number of extremely common Debian packages. This reduces the number of packages that images that derive from it need to install, thus reducing the overall size of all images on your system. --- .template-helpers/variant-default-debian.md | 2 +- .template-helpers/variant-default-ubuntu.md | 2 +- .template-helpers/variant.sh | 33 +++++++++++---------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.template-helpers/variant-default-debian.md b/.template-helpers/variant-default-debian.md index b3f99fbc9..a272dcebf 100644 --- a/.template-helpers/variant-default-debian.md +++ b/.template-helpers/variant-default-debian.md @@ -1 +1 @@ -Some of these tags may have names like %%DEB-SUITES%% in them. These are the suite code names for releases of [Debian](https://wiki.debian.org/DebianReleases) and indicate which release the image is based on. +Some of these tags may have names like %%DEB-SUITES%% in them. These are the suite code names for releases of [Debian](https://wiki.debian.org/DebianReleases) and indicate which release the image is based on. If your image needs to install any additional packages beyond what comes with the image, you'll likely want to specify one of these explicitly to minimize breakage when there are new releases of Debian. diff --git a/.template-helpers/variant-default-ubuntu.md b/.template-helpers/variant-default-ubuntu.md index ef152548d..9d427092c 100644 --- a/.template-helpers/variant-default-ubuntu.md +++ b/.template-helpers/variant-default-ubuntu.md @@ -1 +1 @@ -Some of these tags may have names like %%DEB-SUITES%% in them. These are the suite code names for releases of [Ubuntu](https://wiki.ubuntu.com/Releases) and indicate which release the image is based on. +Some of these tags may have names like %%DEB-SUITES%% in them. These are the suite code names for releases of [Ubuntu](https://wiki.ubuntu.com/Releases) and indicate which release the image is based on. If your image needs to install any additional packages beyond what comes with the image, you'll likely want to specify one of these explicitly to minimize breakage when there are new releases of Ubuntu. diff --git a/.template-helpers/variant.sh b/.template-helpers/variant.sh index bafae6080..79c888532 100755 --- a/.template-helpers/variant.sh +++ b/.template-helpers/variant.sh @@ -20,7 +20,8 @@ join() { commaJoin() { local items=( $(xargs -n1 <<<"$1" | sort -u) ); shift - sep=', ' + + local sep=', ' case "${#items[@]}" in 0) return @@ -100,21 +101,6 @@ if [ -n "$text" ]; then default="$([ -f "$repoDir/variant.md" ] && cat "$repoDir/variant.md" || cat "$dir/variant.md")" default+=$'\n' # parameter expansion eats the trailing newline - # buildpack-deps text - potentialTags="$(bashbrew list --uniq "$bbRepo" | cut -d: -f2)" - for tag in $potentialTags; do - baseImage="$(bashbrew cat -f '{{ .ArchLastStageFrom (.TagEntry.Architectures | first) .TagEntry }}' "$bbRepo:$tag" 2>/dev/null)" - case "$baseImage" in - buildpack-deps:*-*) ;; # "scm", "curl" -- not large images - buildpack-deps:*) - default+=$'\n' # give a little space - default+="$(< "$dir/variant-default-buildpack-deps.md")" - default+=$'\n' # parameter expansion eats the trailing newline - break - ;; - esac - done - if [ "$repo" != 'debian' ] && [ "$repo" != 'ubuntu' ]; then # what is 'jessie', 'stretch' and 'sid' # https://github.com/docker-library/python/issues/343 @@ -151,6 +137,21 @@ if [ -n "$text" ]; then fi fi + # buildpack-deps text + potentialTags="$(bashbrew list --uniq "$bbRepo" | cut -d: -f2)" + for tag in $potentialTags; do + baseImage="$(bashbrew cat -f '{{ .ArchLastStageFrom (.TagEntry.Architectures | first) .TagEntry }}' "$bbRepo:$tag" 2>/dev/null)" + case "$baseImage" in + buildpack-deps:*-*) ;; # "scm", "curl" -- not large images + buildpack-deps:*) + default+=$'\n' # give a little space + default+="$(< "$dir/variant-default-buildpack-deps.md")" + default+=$'\n' # parameter expansion eats the trailing newline + break + ;; + esac + done + echo echo