provide docker registry override in remaining scripts

As done with fe2768c73, provide a mechanism to override the docker
registry used for our remaining docker scripts.

docker.io continues to tighten control[1] on access to its registry.
Provide a mechanism within this script to utilize a different registry
for the base ubuntu image.

[1]: https://www.docker.com/blog/november-2024-updated-plans-announcement/

Tested:
- Confirmed script defaults still works as expected
- Confirmed the following also works now:
  export DOCKER_REG=public.ecr.aws/ubuntu
- Confirmed where applicable that this also works(fedora):
  export DOCKER_REG=public.ecr.aws/docker/library

Change-Id: Ib237183fb9f27573643783b3988cb00614749f4c
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/build-rootfs-size-docker.sh b/build-rootfs-size-docker.sh
index 4acd278..056f1ea 100755
--- a/build-rootfs-size-docker.sh
+++ b/build-rootfs-size-docker.sh
@@ -9,6 +9,9 @@
 #   UBUNTU_MIRROR:    [optional] The URL of a mirror of Ubuntu to override the
 #                     default ones in /etc/apt/sources.list
 #                     default is empty, and no mirror is used.
+#   DOCKER_REG:       <optional, the URL of a docker registry to utilize
+#                     instead of the default docker hub
+#                     (ex. public.ecr.aws/ubuntu)
 #   http_proxy:       The HTTP address of the proxy server to connect to.
 #                     Default: "", proxy is not setup if this is not set
 
@@ -19,6 +22,7 @@
 
 DOCKER_IMG_NAME=${DOCKER_IMG_NAME:-"openbmc/ubuntu-rootfs-size"}
 DISTRO=${DISTRO:-"ubuntu:bionic"}
+docker_reg=${DOCKER_REG:-"docker.io"}
 
 PROXY=""
 
@@ -40,7 +44,7 @@
     fi
 
     Dockerfile=$(cat << EOF
-FROM ${DISTRO}
+FROM ${docker_reg}/${DISTRO}
 
 ${PROXY}
 ${MIRROR}
diff --git a/build-setup.sh b/build-setup.sh
index 1a3255f..f9b9df9 100755
--- a/build-setup.sh
+++ b/build-setup.sh
@@ -23,6 +23,9 @@
 #                     default is empty.
 #  CONTAINER_ONLY     Set to "true" if you only want to build the docker
 #                     container. The bitbake will not occur in this case.
+#  DOCKER_REG:        <optional, the URL of a docker registry to utilize
+#                     instead of the default docker hub
+#                     (ex. public.ecr.aws/ubuntu or public.ecr.aws/docker/library)
 #
 # Docker Image Build Variables:
 #  BITBAKE_OPTS       Set to "-c populate_sdk" or whatever other BitBake options
@@ -87,6 +90,7 @@
 UBUNTU_MIRROR=${UBUNTU_MIRROR:-""}
 ENV_LOCAL_CONF=${ENV_LOCAL_CONF:-""}
 container_only=${CONTAINER_ONLY:-false}
+docker_reg=${DOCKER_REG:-"docker.io"}
 
 # Docker Image Build Variables:
 build_dir=${build_dir:-${WORKSPACE}/build}
@@ -157,7 +161,7 @@
     fi
 
     Dockerfile=$(cat << EOF
-  FROM ${distro}:${img_tag}
+  FROM ${docker_reg}/${distro}:${img_tag}
 
   ${PROXY}
 
@@ -211,7 +215,7 @@
     fi
 
     Dockerfile=$(cat << EOF
-  FROM ${distro}:${img_tag}
+  FROM ${docker_reg}/${distro}:${img_tag}
 
   ${PROXY}
   ${MIRROR}
diff --git a/qemu-build.sh b/qemu-build.sh
index 3e5f422..54044e7 100755
--- a/qemu-build.sh
+++ b/qemu-build.sh
@@ -21,6 +21,9 @@
 #                     Default: "", proxy is not setup if this is not set
 #  WORKSPACE          Path of the workspace directory where the build will
 #                     occur, and output artifacts will be produced.
+#  DOCKER_REG:        <optional, the URL of a docker registry to utilize
+#                     instead of the default docker hub
+#                     (ex. public.ecr.aws/ubuntu)
 #
 ###############################################################################
 # Trace bash processing
@@ -34,6 +37,8 @@
     exit 1
 fi
 
+docker_reg=${DOCKER_REG:-"docker.io"}
+
 # Docker Image Build Variables:
 img_name=qemu-build
 
@@ -89,7 +94,7 @@
 # !!!
 
 Dockerfile=$(cat << EOF
-FROM ubuntu:jammy
+FROM ${docker_reg}/ubuntu:jammy
 
 ${PROXY}
 
diff --git a/scripts/build-qemu-robot-docker.sh b/scripts/build-qemu-robot-docker.sh
index 49fa985..c8e402a 100755
--- a/scripts/build-qemu-robot-docker.sh
+++ b/scripts/build-qemu-robot-docker.sh
@@ -8,6 +8,9 @@
 #                    default is empty, and no mirror is used.
 #  PIP_MIRROR:       <optional, the URL of a PIP mirror>
 #                    default is empty, and no mirror is used.
+#  DOCKER_REG:       <optional, the URL of a docker registry to utilize
+#                    instead of the default docker hub
+#                    (ex. public.ecr.aws/ubuntu)
 #
 #  Parameters:
 #   parm1:  <optional, the name of the docker image to generate>
@@ -22,6 +25,7 @@
 DISTRO=${2:-"ubuntu:jammy"}
 UBUNTU_MIRROR=${UBUNTU_MIRROR:-""}
 PIP_MIRROR=${PIP_MIRROR:-""}
+docker_reg=${DOCKER_REG:-"docker.io"}
 
 MIRROR=""
 if [[ -n "${UBUNTU_MIRROR}" ]]; then
@@ -45,7 +49,7 @@
 ################################# docker img # #################################
 # Create docker image that can run QEMU and Robot Tests
 Dockerfile=$(cat << EOF
-FROM ${DISTRO}
+FROM ${docker_reg}/${DISTRO}
 
 ${MIRROR}