diff --git a/.template-helpers/template.md b/.template-helpers/template.md index 28090fdf..41186503 100644 --- a/.template-helpers/template.md +++ b/.template-helpers/template.md @@ -4,7 +4,7 @@ For more information about this image and its history, please see the [relevant manifest file (`library/%%REPO%%`)](https://github.com/docker-library/official-images/blob/master/library/%%REPO%%) in the [`docker-library/official-images` GitHub repo](https://github.com/docker-library/official-images). -%%CONTENT%%%%LICENSE%% +%%CONTENT%%%%VARIANT%%%%LICENSE%% # Supported Docker versions diff --git a/.template-helpers/variant-onbuild.md b/.template-helpers/variant-onbuild.md new file mode 100644 index 00000000..b51a9ecd --- /dev/null +++ b/.template-helpers/variant-onbuild.md @@ -0,0 +1,3 @@ +## `%%REPO%%:onbuild` + +This image makes building derivative images easier. For most use cases, creating a `Dockerfile` in the base of your project directory with the line `FROM %%REPO%%:onbuild` will be enough to create a stand-alone image for your project. diff --git a/.template-helpers/variant-slim.md b/.template-helpers/variant-slim.md new file mode 100644 index 00000000..d5744ac0 --- /dev/null +++ b/.template-helpers/variant-slim.md @@ -0,0 +1,3 @@ +## `%%REPO%%:slim` + +This image does not contain the common packages contained in the default tag and only contains the minimal packages needed to run `%%REPO%%`. Unless you are working in an environment where *only* the %%REPO%% image will be deployed and you have space constraints, we highly recommend using the default image of this repository. diff --git a/.template-helpers/variant.md b/.template-helpers/variant.md new file mode 100644 index 00000000..554a78c4 --- /dev/null +++ b/.template-helpers/variant.md @@ -0,0 +1,7 @@ +# Image Variants + +The `%%REPO%%` images come in many flavors, each designed for a specific use case. + +## `%%REPO%%:` + +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. This tag is based off of [`buildpack-deps`](https://registry.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. diff --git a/.template-helpers/variant.sh b/.template-helpers/variant.sh new file mode 100755 index 00000000..86c5a600 --- /dev/null +++ b/.template-helpers/variant.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -e + +repo="$1" +if [ -z "$repo" ]; then + echo >&2 "usage: $0 repo" + echo >&2 " ie: $0 hylang" + exit 1 +fi + +dir="$(dirname "$(readlink -f "$BASH_SOURCE")")" + +IFS=$'\n' +tags=( $(curl -sSL 'https://raw.githubusercontent.com/docker-library/official-images/master/library/'"$repo" | grep -vE '^$|^#' | cut -d':' -f1 | sort -u) ) +unset IFS + +text= +for tag in "${tags[@]}"; do + if [ -f "$dir/variant-${tag}.md" ]; then + text+=$'\n' # give a little space + # because parameter expansion eats the trailing newline + text+="$(<"$dir/variant-${tag}.md")"$'\n' + fi +done +if [ "$text" ]; then + # give a little space + echo + echo + cat "$dir/variant.md" + echo "$text" +fi diff --git a/python/README.md b/python/README.md index 8c46a932..9067e366 100644 --- a/python/README.md +++ b/python/README.md @@ -52,6 +52,22 @@ or (again, if you need to use Python 2): docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp python:2 python your-daemon-or-script.py +# Image Variants + +The `python` images come in many flavors, each designed for a specific use case. + +## `python:` + +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. This tag is based off of [`buildpack-deps`](https://registry.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. + +## `python:onbuild` + +This image makes building derivative images easier. For most use cases, creating a `Dockerfile` in the base of your project directory with the line `FROM python:onbuild` will be enough to create a stand-alone image for your project. + +## `python:slim` + +This image does not contain the common packages contained in the default tag and only contains the minimal packages needed to run `python`. Unless you are working in an environment where *only* the python image will be deployed and you have space constraints, we highly recommend using the default image of this repository. + # License View license information for [Python 2](https://docs.python.org/2/license.html) and [Python 3](https://docs.python.org/3/license.html). diff --git a/update.sh b/update.sh index d6bc294c..05f21814 100755 --- a/update.sh +++ b/update.sh @@ -101,6 +101,9 @@ for repo in "${repos[@]}"; do echo ' CONTENT => '"$repo"'/content.md' replace_field "$repo" 'CONTENT' "$(cat "$repo/content.md")" + echo ' VARIANT => variant.sh' + replace_field "$repo" 'VARIANT' "$("$helperDir/variant.sh" "$repo")" + # has to be after CONTENT because it's contained in content.md echo " LOGO => $logo" replace_field "$repo" 'LOGO' "$logo" '\s*'