mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-18 07:18:27 +00:00
Merge pull request #8916 from fidencio/topic/packaging-reuse-already-built-agent
packaging: Don't always build the kata-agent
This commit is contained in:
@@ -2,20 +2,25 @@
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
FROM alpine:3.18
|
||||
FROM ubuntu:22.04
|
||||
ARG RUST_TOOLCHAIN
|
||||
|
||||
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
|
||||
RUN apk --no-cache add \
|
||||
bash \
|
||||
curl \
|
||||
gcc \
|
||||
git \
|
||||
libcap-ng-static \
|
||||
libseccomp-static \
|
||||
make \
|
||||
musl-dev \
|
||||
openssl-dev \
|
||||
openssl-libs-static \
|
||||
protoc && \
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${RUST_TOOLCHAIN}
|
||||
COPY install_libseccomp.sh /usr/bin/install_libseccomp.sh
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
RUN apt-get update && \
|
||||
apt-get --no-install-recommends -y install \
|
||||
ca-certificates \
|
||||
curl \
|
||||
g++ \
|
||||
gcc \
|
||||
libssl-dev \
|
||||
make \
|
||||
musl-tools \
|
||||
openssl \
|
||||
perl \
|
||||
protobuf-compiler && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/ && \
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${RUST_TOOLCHAIN}
|
||||
|
@@ -15,13 +15,30 @@ source "${script_dir}/../../scripts/lib.sh"
|
||||
init_env() {
|
||||
source "$HOME/.cargo/env"
|
||||
|
||||
export LIBC=musl
|
||||
ARCH=$(uname -m)
|
||||
rust_arch=""
|
||||
case ${ARCH} in
|
||||
"aarch64")
|
||||
export LIBC=musl
|
||||
rust_arch=${ARCH}
|
||||
;;
|
||||
"ppc64le")
|
||||
export LIBC=gnu
|
||||
rust_arch="powerpc64le"
|
||||
;;
|
||||
"x86_64")
|
||||
export LIBC=musl
|
||||
rust_arch=${ARCH}
|
||||
;;
|
||||
"s390x")
|
||||
export LIBC=gnu
|
||||
rust_arch=${ARCH}
|
||||
;;
|
||||
esac
|
||||
rustup target add ${rust_arch}-unknown-linux-${LIBC}
|
||||
|
||||
export LIBSECCOMP_LINK_TYPE=static
|
||||
export LIBSECCOMP_LIB_PATH=/usr/lib
|
||||
|
||||
# This is needed to workaround
|
||||
# https://github.com/sfackler/rust-openssl/issues/1624
|
||||
export OPENSSL_NO_VENDOR=Y
|
||||
}
|
||||
|
||||
build_agent_from_source() {
|
||||
@@ -29,6 +46,8 @@ build_agent_from_source() {
|
||||
|
||||
init_env
|
||||
|
||||
/usr/bin/install_libseccomp.sh /usr /usr
|
||||
|
||||
cd src/agent
|
||||
DESTDIR=${DESTDIR} AGENT_POLICY=${AGENT_POLICY} make
|
||||
DESTDIR=${DESTDIR} AGENT_POLICY=${AGENT_POLICY} make install
|
||||
|
@@ -26,6 +26,10 @@ sudo docker pull ${container_image} || \
|
||||
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
|
||||
--env DESTDIR=${DESTDIR} \
|
||||
--env AGENT_POLICY=${AGENT_POLICY:-no} \
|
||||
--env LIBSECCOMP_VERSION=${LIBSECCOMP_VERSION} \
|
||||
--env LIBSECCOMP_URL=${LIBSECCOMP_URL} \
|
||||
--env GPERF_VERSION=${GPERF_VERSION} \
|
||||
--env GPERF_URL=${GPERF_URL} \
|
||||
-w "${repo_root_dir}" \
|
||||
"${container_image}" \
|
||||
bash -c "${agent_builder}"
|
||||
|
Reference in New Issue
Block a user