mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-25 15:15:19 +00:00
db6f894e5e
The script is a development tool that runs all commands in a dedicated container. This allows for containerized, isolated and reproducible builds and CI runs. The script supports the following command: * build: Build Cloud Hypervisor binaries (debug and release) * build-container: Build the container used by the script * tests: Run unit, cargo and integration tests $ ./scripts/dev_cli.sh help Cloud Hypervisor dev_cli.sh Usage: dev_cli.sh <command> [<command args>] Available commands: build [--debug|--release] [-- [<cargo args>]] Build the Cloud Hypervisor binaries. --debug Build the debug binaries. This is the default. --release Build the release binaries. tests [--unit|--cargo|--all] Run the Cloud Hypervisor tests. --unit Run the unit tests. --cargo Run the cargo tests. --integration Run the integration tests. --all Run all tests. build-container [--type] Build the Cloud Hypervisor container. --dev Build dev container. This is the default. help Display this help message. Fixes: #682 Fixes: #684 Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
54 lines
1.4 KiB
Docker
54 lines
1.4 KiB
Docker
FROM ubuntu:18.04 as dev
|
|
|
|
ARG RUST_TOOLCHAIN="1.40.0"
|
|
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"
|
|
|
|
# Install all CI dependencies
|
|
RUN apt-get update
|
|
RUN apt-get -yq upgrade
|
|
RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq \
|
|
build-essential \
|
|
bc \
|
|
docker.io \
|
|
curl \
|
|
wget \
|
|
sudo \
|
|
mtools \
|
|
libssl-dev \
|
|
pkg-config \
|
|
flex \
|
|
bison \
|
|
libelf-dev \
|
|
qemu-utils \
|
|
qemu-system \
|
|
libglib2.0-dev \
|
|
libpixman-1-dev \
|
|
libseccomp-dev \
|
|
libcap-ng-dev \
|
|
socat \
|
|
dosfstools \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install the rust toolchain
|
|
RUN nohup curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN" \
|
|
&& rustup component add rustfmt \
|
|
&& rustup component add clippy \
|
|
&& cargo install cargo-audit \
|
|
&& 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
|
|
RUN echo 'source $CARGO_HOME/env' >> $HOME/.bashrc \
|
|
&& mkdir $HOME/.cargo \
|
|
&& ln -s $CARGO_HOME/env $HOME/.cargo/env
|