mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-16 23:17:42 +00:00
Enabled to run from other scripts as source, etc. Fixes: #11115 Signed-off-by: Shunsuke Kimura <pbrehpuum@gmail.com>
43 lines
827 B
Bash
Executable File
43 lines
827 B
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Copyright 2023 Intel
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
[ -z "${DEBUG}" ] || set -x
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
set -o errtrace
|
|
|
|
KATA_DEBUG_DIR="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")"
|
|
|
|
REGISTRY="${1:-"quay.io/kata-containers/kata-debug"}"
|
|
TAG="${2:-}"
|
|
|
|
arch=$(uname -m)
|
|
[ "$arch" = "x86_64" ] && arch="amd64"
|
|
IMAGE_TAG="${REGISTRY}:$(git rev-parse HEAD)-${arch}"
|
|
|
|
pushd ${KATA_DEBUG_DIR}
|
|
|
|
echo "Building the image"
|
|
docker build --tag ${IMAGE_TAG} .
|
|
|
|
echo "Pushing the image to the registry"
|
|
docker push ${IMAGE_TAG}
|
|
|
|
if [ -n "${TAG}" ]; then
|
|
ADDITIONAL_TAG="${REGISTRY}:${TAG}"
|
|
|
|
echo "Building the ${ADDITIONAL_TAG} image"
|
|
|
|
docker build --tag ${ADDITIONAL_TAG} .
|
|
|
|
echo "Pushing the image ${ADDITIONAL_TAG} to the registry"
|
|
docker push ${ADDITIONAL_TAG}
|
|
fi
|
|
|
|
popd
|