mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Dockerfile: variant support in frozen-images stage
using TARGETVARIANT in frozen-images stage implies changes in `download-frozen-image-v2.sh` script to add support for variants so we are able to build against more platforms. Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -261,6 +261,10 @@ get_target_arch() {
|
||||
echo amd64
|
||||
}
|
||||
|
||||
get_target_variant() {
|
||||
echo "${TARGETVARIANT:-}"
|
||||
}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
imageTag="$1"
|
||||
shift
|
||||
@@ -311,11 +315,13 @@ while [ $# -gt 0 ]; do
|
||||
|
||||
found=""
|
||||
targetArch="$(get_target_arch)"
|
||||
targetVariant="$(get_target_variant)"
|
||||
# parse first level multi-arch manifest
|
||||
for i in "${!layers[@]}"; do
|
||||
layerMeta="${layers[$i]}"
|
||||
maniArch="$(echo "$layerMeta" | jq --raw-output '.platform.architecture')"
|
||||
if [ "$maniArch" = "${targetArch}" ]; then
|
||||
maniVariant="$(echo "$layerMeta" | jq --raw-output '.platform.variant')"
|
||||
if [[ "$maniArch" = "${targetArch}" ]] && [[ -z "${targetVariant}" || "$maniVariant" = "${targetVariant}" ]]; then
|
||||
digest="$(echo "$layerMeta" | jq --raw-output '.digest')"
|
||||
# get second level single manifest
|
||||
submanifestJson="$(
|
||||
@@ -332,7 +338,7 @@ while [ $# -gt 0 ]; do
|
||||
fi
|
||||
done
|
||||
if [ -z "$found" ]; then
|
||||
echo >&2 "error: manifest for $maniArch is not found"
|
||||
echo >&2 "error: manifest for ${targetArch}${targetVariant:+/${targetVariant}} is not found"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user