kata-deploy: Allow passing BASE_IMAGE_{NAME,TAG}

Let's break the IMAGE build parameter into BASE_IMAGE_NAME and
BASE_IMAGE_TAG, as it makes it easier to replace the default CentOS
image by something else.

Spoiler alert, the default CentOS image is **not** multi-arch, and we do
want to support at least aarch64 and s390x in the near term future.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
Fabiano Fidêncio 2023-03-02 15:44:33 +01:00
parent ebe916b372
commit 6267909501
2 changed files with 7 additions and 6 deletions

View File

@ -3,8 +3,9 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# Specify alternative base image, e.g. clefos for s390x # Specify alternative base image, e.g. clefos for s390x
ARG IMAGE ARG BASE_IMAGE_NAME=registry.centos.org/centos
FROM ${IMAGE:-registry.centos.org/centos}:7 ARG BASE_IMAGE_TAG=7
FROM $BASE_IMAGE_NAME:$BASE_IMAGE_TAG
ARG KATA_ARTIFACTS=./kata-static.tar.xz ARG KATA_ARTIFACTS=./kata-static.tar.xz
ARG DESTINATION=/opt/kata-artifacts ARG DESTINATION=/opt/kata-artifacts

View File

@ -20,8 +20,8 @@ IMAGE_TAG="${REGISTRY}:kata-containers-$(git rev-parse HEAD)-$(uname -m)"
echo "Building the image" echo "Building the image"
if [ "$(uname -m)" = "s390x" ]; then if [ "$(uname -m)" = "s390x" ]; then
docker build \ docker build \
--build-arg IMG_NAME=clefos \ --build-arg BASE_IMAGE_NAME=clefos \
--build-arg IMG_TAG=7 \ --build-arg BASE_IMAGE_TAG=7 \
--tag ${IMAGE_TAG} . --tag ${IMAGE_TAG} .
else else
docker build --tag ${IMAGE_TAG} . docker build --tag ${IMAGE_TAG} .
@ -36,8 +36,8 @@ if [ -n "${TAG}" ]; then
echo "Building the ${ADDITIONAL_TAG} image" echo "Building the ${ADDITIONAL_TAG} image"
if [ "$(uname -m)" = "s390x" ]; then if [ "$(uname -m)" = "s390x" ]; then
docker build \ docker build \
--build-arg IMG_NAME=clefos \ --build-arg BASE_IMAGE_NAME=clefos \
--build-arg IMG_TAG=7 \ --build-arg BASE_IMAGE_TAG=7 \
--tag ${ADDITIONAL_TAG} . --tag ${ADDITIONAL_TAG} .
else else
docker build --tag ${ADDITIONAL_TAG} . docker build --tag ${ADDITIONAL_TAG} .