2024-04-02 15:24:50 +00:00
|
|
|
# Copyright © 2024 Intel Corporation
|
|
|
|
#
|
2023-03-15 17:27:51 +00:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
#
|
2022-02-18 09:48:37 +00:00
|
|
|
# When changing this file don't forget to update the tag name in the
|
|
|
|
# .github/workflows/docker-image.yaml file if doing multiple per day
|
|
|
|
|
2023-10-23 12:54:13 +00:00
|
|
|
FROM ubuntu:22.04 as dev
|
2020-01-29 11:48:46 +00:00
|
|
|
|
2020-09-28 11:49:07 +00:00
|
|
|
ARG TARGETARCH
|
2024-05-07 10:42:51 +00:00
|
|
|
ARG RUST_TOOLCHAIN="1.77.0"
|
2020-01-29 11:48:46 +00:00
|
|
|
ARG CLH_SRC_DIR="/cloud-hypervisor"
|
|
|
|
ARG CLH_BUILD_DIR="$CLH_SRC_DIR/build"
|
|
|
|
ARG CARGO_REGISTRY_DIR="$CLH_BUILD_DIR/cargo_registry"
|
|
|
|
ARG CARGO_GIT_REGISTRY_DIR="$CLH_BUILD_DIR/cargo_git_registry"
|
|
|
|
|
|
|
|
ENV CARGO_HOME=/usr/local/rust
|
|
|
|
ENV RUSTUP_HOME=$CARGO_HOME
|
|
|
|
ENV PATH="$PATH:$CARGO_HOME/bin"
|
2023-05-19 13:07:56 +00:00
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
2020-01-29 11:48:46 +00:00
|
|
|
|
|
|
|
# Install all CI dependencies
|
2023-05-19 13:29:44 +00:00
|
|
|
# DL3015 ignored cause not installing openvswitch-switch-dpdk recommended packages breaks ovs_dpdk test
|
|
|
|
# hadolint ignore=DL3008,DL3015
|
2020-04-16 02:02:42 +00:00
|
|
|
RUN apt-get update \
|
2023-03-30 12:37:52 +00:00
|
|
|
&& apt-get -yq upgrade \
|
2023-05-19 13:29:44 +00:00
|
|
|
&& apt-get install --no-install-recommends -yq \
|
2023-03-30 12:37:52 +00:00
|
|
|
build-essential \
|
|
|
|
bc \
|
|
|
|
curl \
|
|
|
|
wget \
|
|
|
|
sudo \
|
|
|
|
mtools \
|
|
|
|
musl-tools \
|
|
|
|
libssl-dev \
|
|
|
|
pkg-config \
|
|
|
|
flex \
|
|
|
|
bison \
|
|
|
|
libelf-dev \
|
|
|
|
qemu-utils \
|
|
|
|
libglib2.0-dev \
|
|
|
|
libpixman-1-dev \
|
|
|
|
libseccomp-dev \
|
|
|
|
libcap-ng-dev \
|
|
|
|
socat \
|
|
|
|
dosfstools \
|
|
|
|
cpio \
|
|
|
|
python3 \
|
|
|
|
python3-setuptools \
|
|
|
|
ntfs-3g \
|
|
|
|
python3-distutils \
|
|
|
|
uuid-dev \
|
|
|
|
iperf3 \
|
|
|
|
zip \
|
|
|
|
git-core \
|
|
|
|
dnsmasq \
|
|
|
|
dmsetup \
|
2023-05-19 13:29:44 +00:00
|
|
|
ca-certificates \
|
|
|
|
unzip \
|
|
|
|
iproute2 \
|
|
|
|
dbus \
|
|
|
|
&& apt-get install openvswitch-switch-dpdk -yq \
|
2020-01-29 11:48:46 +00:00
|
|
|
&& apt-get clean \
|
2023-05-29 15:03:20 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/* /var/log/*log /var/log/apt/* /var/lib/dpkg/*-old /var/cache/debconf/*-old
|
2020-01-29 11:48:46 +00:00
|
|
|
|
2021-05-27 10:44:14 +00:00
|
|
|
RUN update-alternatives --set ovs-vswitchd /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk
|
|
|
|
|
2023-05-19 15:16:20 +00:00
|
|
|
# hadolint ignore=DL3008
|
2020-09-28 11:49:07 +00:00
|
|
|
RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
2023-03-30 12:37:52 +00:00
|
|
|
apt-get update \
|
|
|
|
&& apt-get -yq upgrade \
|
2024-10-18 14:42:43 +00:00
|
|
|
&& apt-get install --no-install-recommends -yq swtpm \
|
2023-03-30 12:37:52 +00:00
|
|
|
&& apt-get clean \
|
2023-05-29 15:03:20 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/* /var/log/*log /var/log/apt/* /var/lib/dpkg/*-old /var/cache/debconf/*-old; fi
|
2020-04-16 02:02:42 +00:00
|
|
|
|
2023-05-19 15:16:20 +00:00
|
|
|
# hadolint ignore=DL3008
|
2020-09-28 11:49:07 +00:00
|
|
|
RUN if [ "$TARGETARCH" = "arm64" ]; then \
|
2020-07-01 03:19:18 +00:00
|
|
|
# On AArch64, `setcap` binary should be installed via `libcap2-bin`.
|
|
|
|
# The `setcap` binary is used in integration tests.
|
2021-09-23 00:57:07 +00:00
|
|
|
# `libguestfs-tools` is used for modifying cloud image kernel, and it requires
|
|
|
|
# kernel (any version) image in `/boot` and modules in `/lib/modules`.
|
2020-07-01 03:19:18 +00:00
|
|
|
apt-get update \
|
|
|
|
&& apt-get -yq upgrade \
|
2023-05-19 13:29:44 +00:00
|
|
|
&& apt-get install --no-install-recommends -yq \
|
2021-09-23 00:57:07 +00:00
|
|
|
libcap2-bin \
|
|
|
|
libguestfs-tools \
|
2022-02-17 18:53:43 +00:00
|
|
|
linux-image-generic \
|
2021-09-26 11:56:10 +00:00
|
|
|
autotools-dev \
|
|
|
|
autoconf \
|
|
|
|
automake \
|
|
|
|
perl \
|
|
|
|
texinfo \
|
2020-07-01 03:19:18 +00:00
|
|
|
&& apt-get clean \
|
2023-05-29 15:03:20 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/* /var/log/*log /var/log/apt/* /var/lib/dpkg/*-old /var/cache/debconf/*-old; fi
|
2020-07-01 03:19:18 +00:00
|
|
|
|
2020-04-28 13:08:32 +00:00
|
|
|
# Fix the libssl-dev install
|
2023-05-19 15:16:20 +00:00
|
|
|
# hadolint ignore=SC2155
|
2020-09-29 07:06:37 +00:00
|
|
|
RUN export ARCH="$(uname -m)" \
|
2023-05-19 15:16:20 +00:00
|
|
|
&& cp /usr/include/"$ARCH"-linux-gnu/openssl/opensslconf.h /usr/include/openssl/
|
2020-09-29 07:06:37 +00:00
|
|
|
ENV X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu/
|
|
|
|
ENV X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu/
|
|
|
|
ENV AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu/
|
|
|
|
ENV AARCH64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu/
|
2020-04-28 13:08:32 +00:00
|
|
|
ENV OPENSSL_INCLUDE_DIR=/usr/include/
|
|
|
|
|
2020-01-29 11:48:46 +00:00
|
|
|
# Install the rust toolchain
|
2023-05-19 15:16:20 +00:00
|
|
|
# hadolint ignore=DL4006,SC2155
|
2020-09-29 07:06:37 +00:00
|
|
|
RUN export ARCH="$(uname -m)" \
|
2022-02-23 13:49:01 +00:00
|
|
|
&& nohup curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain "$RUST_TOOLCHAIN" \
|
2023-05-19 15:16:20 +00:00
|
|
|
&& rustup target add "$ARCH"-unknown-linux-musl --toolchain "$RUST_TOOLCHAIN" \
|
2022-02-23 13:49:01 +00:00
|
|
|
&& if [ "$TARGETARCH" = "amd64" ]; then rustup toolchain add --profile minimal $RUST_TOOLCHAIN-x86_64-unknown-linux-musl; fi \
|
2020-09-28 11:49:07 +00:00
|
|
|
&& if [ "$TARGETARCH" = "amd64" ]; then rustup component add rustfmt; fi \
|
|
|
|
&& if [ "$TARGETARCH" = "amd64" ]; then rustup component add clippy; fi \
|
2020-01-29 11:48:46 +00:00
|
|
|
&& rm -rf "$CARGO_HOME/registry" \
|
|
|
|
&& ln -s "$CARGO_REGISTRY_DIR" "$CARGO_HOME/registry" \
|
|
|
|
&& rm -rf "$CARGO_HOME/git" \
|
|
|
|
&& ln -s "$CARGO_GIT_REGISTRY_DIR" "$CARGO_HOME/git"
|
|
|
|
|
|
|
|
# Set the rust environment
|
2023-05-19 15:16:20 +00:00
|
|
|
# hadolint ignore=SC2016
|
|
|
|
RUN echo 'source $CARGO_HOME/env' >> "$HOME"/.bashrc \
|
|
|
|
&& mkdir "$HOME"/.cargo \
|
|
|
|
&& ln -s $CARGO_HOME/env "$HOME"/.cargo/env
|
2021-09-17 15:52:20 +00:00
|
|
|
|
2021-10-20 17:40:28 +00:00
|
|
|
# install SPDK NVMe
|
|
|
|
# only for 'x86_64' platform images as 'docker buildx' can't build 'spdk'
|
2023-05-19 15:16:20 +00:00
|
|
|
# hadolint ignore=DL3003,SC2046
|
2021-10-20 17:40:28 +00:00
|
|
|
RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
|
|
|
git clone https://github.com/spdk/spdk \
|
|
|
|
&& cd spdk \
|
2023-10-10 09:04:17 +00:00
|
|
|
&& git checkout ef8bcce58f3f02b79c0619a297e4f17e81e62b24 \
|
2021-10-20 17:40:28 +00:00
|
|
|
&& git submodule update --init \
|
|
|
|
&& apt-get update \
|
|
|
|
&& ./scripts/pkgdep.sh \
|
2022-02-23 12:26:43 +00:00
|
|
|
&& apt-get clean \
|
2021-10-20 17:40:28 +00:00
|
|
|
&& ./configure --with-vfio-user \
|
2023-08-04 07:59:32 +00:00
|
|
|
&& make -j $(nproc) TARGET_ARCHITECTURE=skylake \
|
2023-10-10 09:04:17 +00:00
|
|
|
&& rm -rf /usr/local/bin/spdk-nvme \
|
2021-10-20 17:40:28 +00:00
|
|
|
&& mkdir /usr/local/bin/spdk-nvme \
|
2023-10-10 09:04:17 +00:00
|
|
|
&& cp -f ./build/bin/nvmf_tgt /usr/local/bin/spdk-nvme \
|
|
|
|
&& cp -f ./scripts/rpc.py /usr/local/bin/spdk-nvme \
|
|
|
|
&& cp -rf ./python /usr/local/bin \
|
2021-10-20 17:40:28 +00:00
|
|
|
&& cd .. && rm -rf spdk; fi
|
2022-01-20 05:43:04 +00:00
|
|
|
|
|
|
|
# install ethr tool for performance tests
|
2022-02-17 17:45:25 +00:00
|
|
|
RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
2023-05-19 15:16:20 +00:00
|
|
|
wget -nv https://github.com/microsoft/ethr/releases/latest/download/ethr_linux.zip \
|
2022-01-20 05:43:04 +00:00
|
|
|
&& unzip ethr_linux.zip \
|
|
|
|
&& cp ethr /usr/local/bin \
|
2022-02-17 17:45:25 +00:00
|
|
|
&& rm ethr_linux.zip; fi
|