asterinas/tools/docker/Dockerfile.ubuntu22.04

92 lines
2.4 KiB
Docker

FROM ubuntu:22.04 as ubuntu-22.04-with-bazel
SHELL ["/bin/bash", "-c"]
ARG DEBIAN_FRONTEND=noninteractive
# Install all Bazel dependent packages
RUN apt update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
git-core \
gnupg \
python-is-python3 \
python3-pip
# Install bazel, which is required by the system call test suite from Gvisor project
COPY regression/syscall_test/install_bazel.sh /tmp/
WORKDIR /tmp
RUN ./install_bazel.sh && rm -f /tmp/install_bazel.sh
FROM ubuntu-22.04-with-bazel as syscall_test
# Build the syscall test binaries
COPY regression/syscall_test /root/syscall_test
WORKDIR /root/syscall_test
RUN export BUILD_DIR=build && \
make ${BUILD_DIR}/syscall_test_bins
FROM ubuntu-22.04-with-bazel
# Install all Jinux dependent packages
RUN apt update && apt-get install -y --no-install-recommends \
cpio \
cpuid \
file \
g++ \
gdb \
grub-common \
grub-pc \
libssl-dev \
net-tools \
openssh-server \
pkg-config \
qemu-system-x86 \
strace \
sudo \
unzip \
vim \
wget \
xorriso \
zip
# Clean apt cache
RUN apt clean \
&& rm -rf /var/lib/apt/lists/*
# Prepare the system call test suite
COPY --from=syscall_test /root/syscall_test/build/syscall_test_bins /root/syscall_test_bins
ENV JINUX_PREBUILT_SYSCALL_TEST=/root/syscall_test_bins
# Install Rust
ENV PATH="/root/.cargo/bin:${PATH}"
ARG JINUX_RUST_VERSION
RUN curl https://sh.rustup.rs -sSf | \
sh -s -- --default-toolchain ${JINUX_RUST_VERSION} -y \
&& rm -rf /root/.cargo/registry && rm -rf /root/.cargo/git \
&& cargo -V \
&& rustup component add rust-src rustc-dev llvm-tools-preview
# Install mdbook
RUN cargo install mdbook
# Add the path of jinux tools
ENV PATH="/root/jinux/target/bin:${PATH}"
# Build busybox
RUN curl --output busybox.tar.bz2 https://busybox.net/downloads/busybox-1.35.0.tar.bz2 \
&& mkdir /root/busybox \
&& tar xf busybox.tar.bz2 --strip-components=1 -C /root/busybox \
&& rm busybox.tar.bz2
WORKDIR /root/busybox
RUN make defconfig \
&& sed -i "s/# CONFIG_STATIC is not set/CONFIG_STATIC=y/g" .config \
&& sed -i "s/# CONFIG_FEATURE_SH_STANDALONE is not set/CONFIG_FEATURE_SH_STANDALONE=y/g" .config \
&& make -j \
&& cp /root/busybox/busybox /bin/busybox
VOLUME [ "/root/jinux" ]
WORKDIR /root/jinux