mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-24 18:27:10 +00:00
kata-deploy: add installation for runtime-rs
setup the compile environment and installation path for the Rust runtime Fixes:#5000 Signed-off-by: Zhongtao Hu <zhongtaohu.tim@linux.alibaba.com>
This commit is contained in:
@@ -13,10 +13,13 @@ RUN apt-get update && \
|
||||
gcc \
|
||||
git \
|
||||
make \
|
||||
musl-tools \
|
||||
sudo && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/
|
||||
|
||||
COPY install_go.sh /usr/bin/install_go.sh
|
||||
COPY install_go_rust.sh /usr/bin/install_go_rust.sh
|
||||
ARG GO_VERSION
|
||||
RUN install_go.sh "${GO_VERSION}"
|
||||
ARG RUST_VERSION
|
||||
RUN install_go_rust.sh "${GO_VERSION}" "${RUST_VERSION}"
|
||||
ENV PATH=/usr/local/go/bin:${PATH}
|
||||
ENV PATH=/root/.cargo/bin/:${PATH}
|
||||
|
@@ -14,18 +14,29 @@ readonly kernel_builder="${repo_root_dir}/tools/packaging/kernel/build-kernel.sh
|
||||
|
||||
|
||||
GO_VERSION=${GO_VERSION}
|
||||
RUST_VERSION=${RUST_VERSION}
|
||||
|
||||
DESTDIR=${DESTDIR:-${PWD}}
|
||||
PREFIX=${PREFIX:-/opt/kata}
|
||||
container_image="shim-v2-builder"
|
||||
|
||||
sudo docker build --build-arg GO_VERSION="${GO_VERSION}" -t "${container_image}" "${script_dir}"
|
||||
sudo docker build --build-arg GO_VERSION="${GO_VERSION}" --build-arg RUST_VERSION="${RUST_VERSION}" -t "${container_image}" "${script_dir}"
|
||||
|
||||
arch=$(uname -m)
|
||||
if [ ${arch} = "ppc64le" ]; then
|
||||
arch="ppc64"
|
||||
fi
|
||||
|
||||
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
|
||||
-w "${repo_root_dir}/src/runtime-rs" \
|
||||
"${container_image}" \
|
||||
bash -c "git config --global --add safe.directory ${repo_root_dir} && make PREFIX=${PREFIX} QEMUCMD=qemu-system-${arch}"
|
||||
|
||||
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
|
||||
-w "${repo_root_dir}/src/runtime-rs" \
|
||||
"${container_image}" \
|
||||
bash -c "git config --global --add safe.directory ${repo_root_dir} && make PREFIX="${PREFIX}" DESTDIR="${DESTDIR}" install"
|
||||
|
||||
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
|
||||
-w "${repo_root_dir}/src/runtime" \
|
||||
"${container_image}" \
|
||||
|
@@ -50,6 +50,13 @@ EOF
|
||||
|
||||
trap finish EXIT
|
||||
|
||||
rust_version=${2:-}
|
||||
ARCH=${ARCH:-$(uname -m)}
|
||||
LIBC=${LIBC:-musl}
|
||||
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSLf | sh -s -- -y --default-toolchain ${rust_version} -t ${ARCH}-unknown-linux-${LIBC}
|
||||
source /root/.cargo/env
|
||||
rustup target add x86_64-unknown-linux-musl
|
||||
|
||||
pushd "${tmp_dir}"
|
||||
|
||||
while getopts "d:fh" opt
|
Reference in New Issue
Block a user