From 78d6ca135994ebe31bd8c4d3effb3e0896c2deed Mon Sep 17 00:00:00 2001 From: William Blankenship Date: Mon, 16 Mar 2015 19:08:12 -0500 Subject: [PATCH] Detect if base image uses buildpack-deps --- .template-helpers/variant.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.template-helpers/variant.sh b/.template-helpers/variant.sh index 86c5a600..a60914e0 100755 --- a/.template-helpers/variant.sh +++ b/.template-helpers/variant.sh @@ -9,9 +9,10 @@ if [ -z "$repo" ]; then fi dir="$(dirname "$(readlink -f "$BASH_SOURCE")")" +url='https://raw.githubusercontent.com/docker-library/official-images/master/library/'"$repo" IFS=$'\n' -tags=( $(curl -sSL 'https://raw.githubusercontent.com/docker-library/official-images/master/library/'"$repo" | grep -vE '^$|^#' | cut -d':' -f1 | sort -u) ) +tags=( $(curl -sSL $url | grep -vE '^$|^#' | cut -d':' -f1 | sort -u) ) unset IFS text= @@ -23,9 +24,14 @@ for tag in "${tags[@]}"; do fi done if [ "$text" ]; then - # give a little space - echo - echo - cat "$dir/variant.md" - echo "$text" + latest=($(curl -sSL $url | sed -e 's/git:\/\/github.com\///' -e 's/@/ /' - | grep "latest")) + dockerfile='https://raw.githubusercontent.com/'"${latest[1]}"'/'"${latest[2]}"'/'"${latest[3]}"'/Dockerfile' + base_image=$(curl -sSL $dockerfile | sed 's/:/\t/' | nawk '/^FROM .*$/ { print $2 }') + if [ "$base_image" = "buildpack-deps" ]; then + # give a little space + echo + echo + cat "$dir/variant.md" + echo "$text" + fi fi