mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-01 08:56:32 +00:00
local-build: consider cross-compilation env
This is to make a base builder image build genprotimg without a package manager under the cross-compilation environment. Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
This commit is contained in:
@@ -17,7 +17,10 @@ readonly kata_root_dir="$(cd "${packaging_root_dir}/../../" && pwd)"
|
|||||||
source "$kata_root_dir/ci/lib.sh"
|
source "$kata_root_dir/ci/lib.sh"
|
||||||
source "${packaging_root_dir}/scripts/lib.sh"
|
source "${packaging_root_dir}/scripts/lib.sh"
|
||||||
|
|
||||||
[ "$(uname -m)" = s390x ] || die "Building a Secure Execution image is currently only supported on s390x."
|
ARCH=${ARCH:-$(uname -m)}
|
||||||
|
if [ $(uname -m) == "${ARCH}" ]; then
|
||||||
|
[ "${ARCH}" == "s390x" ] || die "Building a Secure Execution image is currently only supported on s390x."
|
||||||
|
fi
|
||||||
|
|
||||||
finish() {
|
finish() {
|
||||||
if [ -e "${parmfile}" ]; then
|
if [ -e "${parmfile}" ]; then
|
||||||
|
@@ -5,6 +5,9 @@
|
|||||||
FROM ubuntu:20.04
|
FROM ubuntu:20.04
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
ENV INSTALL_IN_GOPATH=false
|
ENV INSTALL_IN_GOPATH=false
|
||||||
|
# Required for libxml2-dev
|
||||||
|
ENV TZ=Etc/UTC
|
||||||
|
ARG ARCH
|
||||||
|
|
||||||
COPY install_yq.sh /usr/bin/install_yq.sh
|
COPY install_yq.sh /usr/bin/install_yq.sh
|
||||||
COPY install_oras.sh /usr/bin/install_oras.sh
|
COPY install_oras.sh /usr/bin/install_oras.sh
|
||||||
@@ -40,16 +43,43 @@ RUN if [ ${IMG_USER} != "root" ] && [ ! -z ${HOST_DOCKER_GID} ]; then groupadd -
|
|||||||
RUN if [ ${IMG_USER} != "root" ] && [ ! -z ${HOST_DOCKER_GID} ]; then usermod -a -G docker_on_host ${IMG_USER};fi
|
RUN if [ ${IMG_USER} != "root" ] && [ ! -z ${HOST_DOCKER_GID} ]; then usermod -a -G docker_on_host ${IMG_USER};fi
|
||||||
RUN sh -c "echo '${IMG_USER} ALL=NOPASSWD: ALL' >> /etc/sudoers"
|
RUN sh -c "echo '${IMG_USER} ALL=NOPASSWD: ALL' >> /etc/sudoers"
|
||||||
|
|
||||||
|
RUN if [ "${ARCH}" != "$(uname -m)" ] && [ "${ARCH}" == "s390x" ]; then sed -i 's/^deb/deb [arch=amd64]/g' /etc/apt/sources.list && \
|
||||||
|
dpkg --add-architecture "s390x" && \
|
||||||
|
echo "deb [arch=s390x] http://ports.ubuntu.com/ focal main multiverse universe" >> /etc/apt/sources.list && \
|
||||||
|
echo "deb [arch=s390x] http://ports.ubuntu.com/ focal-security main multiverse universe" >> /etc/apt/sources.list && \
|
||||||
|
echo "deb [arch=s390x] http://ports.ubuntu.com/ focal-backports main multiverse universe" >> /etc/apt/sources.list && \
|
||||||
|
echo "deb [arch=s390x] http://ports.ubuntu.com/ focal-updates main multiverse universe" >> /etc/apt/sources.list; fi
|
||||||
|
|
||||||
#FIXME: gcc is required as agent is build out of a container build.
|
#FIXME: gcc is required as agent is build out of a container build.
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install --no-install-recommends -y \
|
apt-get install --no-install-recommends -y \
|
||||||
build-essential \
|
build-essential \
|
||||||
cpio \
|
cpio \
|
||||||
gcc \
|
gcc \
|
||||||
unzip \
|
unzip \
|
||||||
xz-utils && \
|
xz-utils && \
|
||||||
if uname -m | grep -Eq 's390x'; then apt-get install -y s390-tools; fi && \
|
if [ "${ARCH}" != "$(uname -m)" ] && [ "${ARCH}" == "s390x" ]; then \
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists
|
apt-get install -y --no-install-recommends \
|
||||||
|
gcc-s390x-linux-gnu \
|
||||||
|
g++-s390x-linux-gnu \
|
||||||
|
binutils-s390x-linux-gnu \
|
||||||
|
dpkg-dev \
|
||||||
|
apt-utils \
|
||||||
|
libssl-dev:s390x \
|
||||||
|
libcurl4-openssl-dev:s390x \
|
||||||
|
libjson-c-dev:s390x \
|
||||||
|
pkg-config:s390x \
|
||||||
|
libxml2-dev:s390x \
|
||||||
|
libjson-c-dev:s390x \
|
||||||
|
libglib2.0-0:s390x \
|
||||||
|
libglib2.0-dev:s390x; \
|
||||||
|
elif uname -m | grep -Eq 's390x'; then apt-get install -y s390-tools; fi && \
|
||||||
|
apt-get clean && rm -rf /var/lib/apt/lists
|
||||||
|
|
||||||
|
RUN if [ "${ARCH}" != "$(uname -m)" ] && [ "${ARCH}" == "s390x" ]; then \
|
||||||
|
git clone -b v2.25.0 https://github.com/ibm-s390-linux/s390-tools.git && cd s390-tools && \
|
||||||
|
pushd genprotimg && pushd boot && make CROSS_COMPILE=s390x-linux-gnu- && popd && pushd src && \
|
||||||
|
make CROSS_COMPILE=s390x-linux-gnu- && popd && make install && popd || return; fi
|
||||||
|
|
||||||
ENV USER ${IMG_USER}
|
ENV USER ${IMG_USER}
|
||||||
USER ${IMG_USER}
|
USER ${IMG_USER}
|
||||||
|
@@ -75,6 +75,7 @@ docker build -q -t build-kata-deploy \
|
|||||||
--build-arg http_proxy="${http_proxy}" \
|
--build-arg http_proxy="${http_proxy}" \
|
||||||
--build-arg https_proxy="${https_proxy}" \
|
--build-arg https_proxy="${https_proxy}" \
|
||||||
--build-arg HOST_DOCKER_GID=${docker_gid} \
|
--build-arg HOST_DOCKER_GID=${docker_gid} \
|
||||||
|
--build-arg ARCH="${ARCH}" \
|
||||||
"${script_dir}/dockerbuild/"
|
"${script_dir}/dockerbuild/"
|
||||||
|
|
||||||
CI="${CI:-}"
|
CI="${CI:-}"
|
||||||
|
Reference in New Issue
Block a user