mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-03 14:34:21 +01:00
Let's add the needed infra for only building and pushing the kernel builder image to the Kata Containers' quay.io registry. Fixes: #5476 Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
42 lines
1.3 KiB
Bash
Executable File
42 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Copyright (c) 2021 Intel Corporation
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
|
|
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
readonly repo_root_dir="$(cd "${script_dir}/../../../.." && pwd)"
|
|
readonly kernel_builder="${repo_root_dir}/tools/packaging/kernel/build-kernel.sh"
|
|
|
|
source "${script_dir}/../../scripts/lib.sh"
|
|
|
|
DESTDIR=${DESTDIR:-${PWD}}
|
|
PREFIX=${PREFIX:-/opt/kata}
|
|
container_image="${CC_BUILDER_REGISTRY}:kernel-$(get_last_modification ${repo_root_dir} ${script_dir})"
|
|
|
|
sudo docker pull ${container_image} || \
|
|
(sudo docker build -t "${container_image}" "${script_dir}" && \
|
|
# No-op unless PUSH_TO_REGISTRY is exported as "yes"
|
|
push_to_registry "${container_image}")
|
|
|
|
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
|
|
-w "${PWD}" \
|
|
--env KATA_BUILD_CC="${KATA_BUILD_CC:-}" \
|
|
"${container_image}" \
|
|
bash -c "${kernel_builder} $* setup"
|
|
|
|
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
|
|
-w "${PWD}" \
|
|
"${container_image}" \
|
|
bash -c "${kernel_builder} $* build"
|
|
|
|
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
|
|
-w "${PWD}" \
|
|
--env DESTDIR="${DESTDIR}" --env PREFIX="${PREFIX}" \
|
|
"${container_image}" \
|
|
bash -c "${kernel_builder} $* install"
|