asterinas/tools/docker/Dockerfile

94 lines
2.5 KiB
Docker
Raw Normal View History

# SPDX-License-Identifier: MPL-2.0
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
#= Download dependency =====================================================
WORKDIR /opt/linux_binary_cache
RUN wget https://raw.githubusercontent.com/asterinas/linux_binary_cache/24db4ff/vmlinuz-6.16.0 \
-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
#= Build syscall test =========================================================
FROM build-base AS build-bazel
# 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/
WORKDIR /root/bazel
2024-01-03 03:29:28 +00:00
RUN ./install_bazel.sh
RUN apt clean && rm -rf /var/lib/apt/lists/*
WORKDIR /root
RUN rm -rf bazel
2025-06-04 02:15:25 +00:00
FROM build-bazel AS build-gvisor
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
RUN export BUILD_DIR=build && \
make ${BUILD_DIR}/syscall_test_bins
#= The final stages to produce the Asterinas development image ====================
FROM build-base
# Install all Asterinas dependent packages
RUN apt update && apt-get install -y --no-install-recommends \
bridge-utils \
clang-format `# formatting general tests` \
cpio \
cpuid \
dosfstools \
exfatprogs \
file \
grub-efi-amd64-bin \
grub-efi-amd64-dbg \
iptables \
iproute2 \
2025-07-02 07:08:15 +00:00
jq \
net-tools \
openssh-server \
parted \
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
RUN apt clean && rm -rf /var/lib/apt/lists/*
2023-07-05 06:08:58 +00:00
2025-11-11 11:47:46 +00:00
# Install sctrace
RUN ln -s /root/asterinas/tools/sctrace.sh /usr/local/bin/sctrace
# Set the `ASTER_SCML` env var to make sctrace easier to use for Asterinas developers.
# For more information, check out the README of sctrace.
RUN echo 'export ASTER_SCML=$(find /root/asterinas/book/src/kernel/linux-compatibility/ -name "*.scml")' >> /root/.bashrc
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
# Add the path of Asterinas tools
ENV PATH="/root/asterinas/target/bin:${PATH}"
2023-07-05 06:08:58 +00:00
VOLUME [ "/root/asterinas" ]
2023-07-05 06:08:58 +00:00
WORKDIR /root/asterinas