mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-07-10 15:56:47 +00:00
Install libdevmapper-dev and pkg-config in the agent build container so devicemapper-sys can link against libdevmapper. Add the GNU libc rustup target alongside musl since USE_DEVMAPPER forces LIBC=gnu. Forward USE_DEVMAPPER through build.sh and build-static-agent.sh. And you can compile the device mapper in kata-agent as below: ``` $ make LIBC=gnu USE_DEVMAPPER=yes ``` Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
75 lines
2.1 KiB
Docker
75 lines
2.1 KiB
Docker
# Copyright (c) 2023 Intel
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
FROM ubuntu:22.04
|
|
ARG RUST_TOOLCHAIN
|
|
|
|
COPY install_libseccomp.sh /usr/bin/install_libseccomp.sh
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
ENV RUSTUP_HOME="/opt/rustup"
|
|
ENV CARGO_HOME="/opt/cargo"
|
|
ENV PATH="/opt/cargo/bin/:${PATH}"
|
|
ENV OPT_LIB="/opt/lib"
|
|
|
|
ENV LIBSECCOMP_LINK_TYPE=static
|
|
ENV LIBSECCOMP_LIB_PATH=${OPT_LIB}
|
|
|
|
ENV PKG_CONFIG_PATH=${OPT_LIB}/pkgconfig:$PKG_CONFIG_PATH
|
|
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
|
|
RUN mkdir ${RUSTUP_HOME} ${CARGO_HOME} && chmod -R a+rwX /opt
|
|
|
|
RUN apt-get update && \
|
|
apt-get --no-install-recommends -y install \
|
|
ca-certificates \
|
|
clang \
|
|
curl \
|
|
g++ \
|
|
gcc \
|
|
gnupg \
|
|
libdevmapper-dev \
|
|
libprotobuf-dev \
|
|
libssl-dev \
|
|
make \
|
|
musl-tools \
|
|
openssl \
|
|
perl \
|
|
pkg-config \
|
|
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}
|
|
|
|
# Install ORAS CLI for tarball caching
|
|
ARG ORAS_VERSION=1.3.0
|
|
RUN ARCH=$(uname -m) && \
|
|
case "${ARCH}" in \
|
|
x86_64) ORAS_ARCH="amd64" ;; \
|
|
aarch64) ORAS_ARCH="arm64" ;; \
|
|
ppc64le) ORAS_ARCH="ppc64le" ;; \
|
|
s390x) ORAS_ARCH="s390x" ;; \
|
|
*) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \
|
|
esac && \
|
|
curl -sSL "https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_${ORAS_ARCH}.tar.gz" -o /tmp/oras.tar.gz && \
|
|
tar -xzf /tmp/oras.tar.gz -C /usr/local/bin oras && \
|
|
rm /tmp/oras.tar.gz && \
|
|
oras version
|
|
|
|
RUN ARCH=$(uname -m); \
|
|
rust_arch=""; \
|
|
libc=""; \
|
|
case "${ARCH}" in \
|
|
"aarch64") rust_arch="${ARCH}"; libc="musl" ;; \
|
|
"ppc64le") rust_arch="powerpc64le"; libc="gnu" ;; \
|
|
"x86_64") rust_arch="${ARCH}"; libc="musl" ;; \
|
|
"s390x") rust_arch="${ARCH}"; libc="gnu" ;; \
|
|
*) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \
|
|
esac; \
|
|
rustup target add "${rust_arch}-unknown-linux-${libc}"; \
|
|
if [ "${libc}" != "gnu" ]; then \
|
|
rustup target add "${rust_arch}-unknown-linux-gnu"; \
|
|
fi
|