mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 14:54:19 +01:00
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>
51 lines
1.1 KiB
Bash
Executable File
51 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Copyright 2022 Intel
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
KATA_DEPLOY_DIR="`dirname ${0}`/../../kata-deploy-cc"
|
|
KATA_DEPLOY_ARTIFACT="${1:-"kata-static.tar.xz"}"
|
|
REGISTRY="${2:-"quay.io/kata-containers/kata-deploy"}"
|
|
TAG="${3:-}"
|
|
|
|
echo "Copying ${KATA_DEPLOY_ARTIFACT} to ${KATA_DEPLOY_DIR}"
|
|
cp ${KATA_DEPLOY_ARTIFACT} ${KATA_DEPLOY_DIR}
|
|
|
|
pushd ${KATA_DEPLOY_DIR}
|
|
|
|
IMAGE_TAG="${REGISTRY}:kata-containers-$(git rev-parse HEAD)-$(uname -m)"
|
|
|
|
echo "Building the image"
|
|
if [ "$(uname -m)" = "s390x" ]; then
|
|
docker build \
|
|
--build-arg BASE_IMAGE_NAME=clefos \
|
|
--build-arg BASE_IMAGE_TAG=7 \
|
|
--tag ${IMAGE_TAG} .
|
|
else
|
|
docker build --tag ${IMAGE_TAG} .
|
|
fi
|
|
|
|
echo "Pushing the image to quay.io"
|
|
docker push ${IMAGE_TAG}
|
|
|
|
if [ -n "${TAG}" ]; then
|
|
ADDITIONAL_TAG="${REGISTRY}:${TAG}"
|
|
|
|
echo "Building the ${ADDITIONAL_TAG} image"
|
|
if [ "$(uname -m)" = "s390x" ]; then
|
|
docker build \
|
|
--build-arg BASE_IMAGE_NAME=clefos \
|
|
--build-arg BASE_IMAGE_TAG=7 \
|
|
--tag ${ADDITIONAL_TAG} .
|
|
else
|
|
docker build --tag ${ADDITIONAL_TAG} .
|
|
fi
|
|
|
|
echo "Pushing the image ${ADDITIONAL_TAG} to quay.io"
|
|
docker push ${ADDITIONAL_TAG}
|
|
fi
|
|
|
|
popd
|