osbuilder: Allow image registry to be customizable

Give the user chance to specify their own registry in event the default
provided are not accessible, desirable.

Fixes: #1393

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
This commit is contained in:
Eric Ernst
2021-02-10 12:32:55 -08:00
parent cb6d2f3c40
commit 49bdbac606
2 changed files with 28 additions and 11 deletions

View File

@@ -84,14 +84,15 @@ Options:
-r Free space of the root partition in MB ENV: ROOT_FREE_SPACE
Extra environment variables:
AGENT_BIN: Use it to change the expected agent binary name
AGENT_INIT: Use kata agent as init process
FS_TYPE: Filesystem type to use. Only xfs and ext4 are supported.
NSDAX_BIN: Use to specify path to pre-compiled 'nsdax' tool.
USE_DOCKER: If set will build image in a Docker Container (requries docker)
DEFAULT: not set
USE_PODMAN: If set and USE_DOCKER not set, will build image in a Podman Container (requries podman)
DEFAULT: not set
AGENT_BIN: Use it to change the expected agent binary name
AGENT_INIT: Use kata agent as init process
IMAGE_REGISTRY: Hostname for the image registry used to pull down the rootfs build image.
FS_TYPE: Filesystem type to use. Only xfs and ext4 are supported.
NSDAX_BIN: Use to specify path to pre-compiled 'nsdax' tool.
USE_DOCKER: If set will build image in a Docker Container (requries docker)
DEFAULT: not set
USE_PODMAN: If set and USE_DOCKER not set, will build image in a Podman Container (requries podman)
DEFAULT: not set
Following diagram shows how the resulting image will look like
@@ -137,7 +138,13 @@ build_with_container() {
image_dir=$(readlink -f "$(dirname "${image}")")
image_name=$(basename "${image}")
REGISTRY_ARG=""
if [ -n "${IMAGE_REGISTRY}" ]; then
REGISTRY_ARG="--build-arg IMAGE_REGISTRY=${IMAGE_REGISTRY}"
fi
"${container_engine}" build \
${REGISTRY_ARG} \
--build-arg http_proxy="${http_proxy}" \
--build-arg https_proxy="${https_proxy}" \
-t "${container_image_name}" "${script_dir}"