2024-01-03 06:40:54 +00:00
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
|
2025-04-30 14:14:32 +00:00
|
|
|
ARG BASE_VERSION
|
2025-07-02 07:08:15 +00:00
|
|
|
FROM asterinas/nix:${BASE_VERSION} AS build-base
|
2023-07-05 06:08:58 +00:00
|
|
|
|
|
|
|
|
SHELL ["/bin/bash", "-c"]
|
|
|
|
|
|
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
2024-03-15 16:46:36 +00:00
|
|
|
|
2024-06-26 09:36:45 +00:00
|
|
|
#= Download dependency =====================================================
|
|
|
|
|
|
2024-09-13 12:11:33 +00:00
|
|
|
WORKDIR /opt/linux_binary_cache
|
2024-10-08 07:34:22 +00:00
|
|
|
RUN wget https://raw.githubusercontent.com/asterinas/linux_binary_cache/14598b6/vmlinuz-5.15.0-105 \
|
2024-06-26 09:36:45 +00:00
|
|
|
-O vmlinuz
|
|
|
|
|
|
2025-08-21 08:37:54 +00:00
|
|
|
#= Download VDSO files =====================================================
|
|
|
|
|
|
|
|
|
|
WORKDIR /root
|
|
|
|
|
RUN git clone https://github.com/asterinas/linux_vdso.git && \
|
|
|
|
|
cd linux_vdso && \
|
|
|
|
|
git checkout 7489835
|
|
|
|
|
|
2025-08-22 08:52:53 +00:00
|
|
|
ENV VDSO_LIBRARY_DIR="/root/linux_vdso"
|
2025-08-21 08:37:54 +00:00
|
|
|
|
2023-10-08 09:38:24 +00:00
|
|
|
#= Build syscall test =========================================================
|
|
|
|
|
|
2025-04-20 13:00:14 +00:00
|
|
|
FROM build-base AS build-bazel
|
2023-07-27 07:09:25 +00:00
|
|
|
|
|
|
|
|
# Install bazel, which is required by the system call test suite from Gvisor project
|
2024-01-03 03:29:28 +00:00
|
|
|
RUN mkdir -p /root/bazel
|
|
|
|
|
COPY tools/install_bazel.sh /root/bazel/
|
2023-10-08 09:38:24 +00:00
|
|
|
WORKDIR /root/bazel
|
2024-01-03 03:29:28 +00:00
|
|
|
RUN ./install_bazel.sh
|
2023-10-08 09:38:24 +00:00
|
|
|
RUN apt clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
WORKDIR /root
|
|
|
|
|
RUN rm -rf bazel
|
2023-07-27 07:09:25 +00:00
|
|
|
|
2025-06-04 02:15:25 +00:00
|
|
|
FROM build-bazel AS build-gvisor
|
2023-07-27 07:09:25 +00:00
|
|
|
|
2025-06-04 02:15:25 +00:00
|
|
|
# Build the gvisor syscall test binaries
|
2025-07-02 11:10:37 +00:00
|
|
|
COPY test/src/syscall/gvisor /root/gvisor
|
2025-06-04 02:15:25 +00:00
|
|
|
WORKDIR /root/gvisor
|
2025-04-20 13:00:14 +00:00
|
|
|
RUN export BUILD_DIR=build && \
|
2023-07-27 07:09:25 +00:00
|
|
|
make ${BUILD_DIR}/syscall_test_bins
|
|
|
|
|
|
2023-12-25 08:01:48 +00:00
|
|
|
#= The final stages to produce the Asterinas development image ====================
|
2023-10-08 09:38:24 +00:00
|
|
|
|
2025-04-30 14:14:32 +00:00
|
|
|
FROM build-base
|
2023-07-27 07:09:25 +00:00
|
|
|
|
2023-12-25 08:01:48 +00:00
|
|
|
# Install all Asterinas dependent packages
|
2025-04-20 13:00:14 +00:00
|
|
|
RUN apt update && apt-get install -y --no-install-recommends \
|
|
|
|
|
bridge-utils \
|
|
|
|
|
clang-format `# formatting general tests` \
|
|
|
|
|
cpio \
|
|
|
|
|
cpuid \
|
|
|
|
|
exfatprogs \
|
|
|
|
|
file \
|
|
|
|
|
grub-efi-amd64-bin \
|
|
|
|
|
grub-efi-amd64-dbg \
|
|
|
|
|
iptables \
|
|
|
|
|
iproute2 \
|
2025-07-02 07:08:15 +00:00
|
|
|
jq \
|
2025-04-20 13:00:14 +00:00
|
|
|
net-tools \
|
|
|
|
|
openssh-server \
|
|
|
|
|
pkg-config \
|
|
|
|
|
socat \
|
|
|
|
|
strace \
|
|
|
|
|
sudo \
|
|
|
|
|
unzip \
|
|
|
|
|
vim \
|
2024-02-27 12:28:43 +00:00
|
|
|
zip
|
2023-07-05 06:08:58 +00:00
|
|
|
# Clean apt cache
|
2023-10-08 09:38:24 +00:00
|
|
|
RUN apt clean && rm -rf /var/lib/apt/lists/*
|
2023-07-05 06:08:58 +00:00
|
|
|
|
2025-07-02 07:08:15 +00:00
|
|
|
# Copy the gvisor syscall test binaries
|
2025-06-04 02:15:25 +00:00
|
|
|
COPY --from=build-gvisor /root/gvisor/build/syscall_test_bins /root/syscall_test_bins
|
2025-07-02 07:08:15 +00:00
|
|
|
ENV GVISOR_PREBUILT_DIR=/root/syscall_test_bins
|
2024-08-31 06:14:14 +00:00
|
|
|
|
2023-12-25 08:01:48 +00:00
|
|
|
# Add the path of Asterinas tools
|
|
|
|
|
ENV PATH="/root/asterinas/target/bin:${PATH}"
|
2023-07-05 06:08:58 +00:00
|
|
|
|
2023-12-25 08:01:48 +00:00
|
|
|
VOLUME [ "/root/asterinas" ]
|
2023-07-05 06:08:58 +00:00
|
|
|
|
2023-12-25 08:01:48 +00:00
|
|
|
WORKDIR /root/asterinas
|