mirror of
https://github.com/docker-library/ruby.git
synced 2022-11-09 11:41:34 -05:00
52 lines
1.1 KiB
Bash
52 lines
1.1 KiB
Bash
|
#!/usr/bin/env bash
|
||
|
set -Eeuo pipefail
|
||
|
|
||
|
[ -f versions.json ] # run "versions.sh" first
|
||
|
|
||
|
jqt='.jq-template.awk'
|
||
|
if [ -n "${BASHBREW_SCRIPTS:-}" ]; then
|
||
|
jqt="$BASHBREW_SCRIPTS/jq-template.awk"
|
||
|
elif [ "$BASH_SOURCE" -nt "$jqt" ]; then
|
||
|
# # https://github.com/docker-library/bashbrew/blob/master/scripts/jq-template.awk
|
||
|
wget -qO "$jqt" 'https://github.com/docker-library/bashbrew/raw/00e281f36edd19f52541a6ba2f215cc3c4645128/scripts/jq-template.awk'
|
||
|
fi
|
||
|
|
||
|
if [ "$#" -eq 0 ]; then
|
||
|
versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)"
|
||
|
eval "set -- $versions"
|
||
|
fi
|
||
|
|
||
|
generated_warning() {
|
||
|
cat <<-EOH
|
||
|
#
|
||
|
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
|
||
|
#
|
||
|
# PLEASE DO NOT EDIT IT DIRECTLY.
|
||
|
#
|
||
|
|
||
|
EOH
|
||
|
}
|
||
|
|
||
|
for version; do
|
||
|
export version
|
||
|
|
||
|
rm -rf "$version/"
|
||
|
|
||
|
variants="$(jq -r '.[env.version].variants | map(@sh) | join(" ")' versions.json)"
|
||
|
eval "variants=( $variants )"
|
||
|
|
||
|
for variant in "${variants[@]}"; do
|
||
|
export variant
|
||
|
|
||
|
dir="$version/$variant"
|
||
|
mkdir -p "$dir"
|
||
|
|
||
|
echo "processing $dir ..."
|
||
|
|
||
|
{
|
||
|
generated_warning
|
||
|
gawk -f "$jqt" Dockerfile.template
|
||
|
} > "$dir/Dockerfile"
|
||
|
done
|
||
|
done
|