ARG OCCLUM_VERSION
FROM occlum/occlum:$OCCLUM_VERSION-ubuntu20.04 as base
LABEL maintainer="He Sun <bochang.sh@antgroup.com>"

# Install bazel
WORKDIR /root
RUN apt update && apt install curl gnupg -y && \
    curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg && \
    mv bazel.gpg /etc/apt/trusted.gpg.d/ && \
    echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list && \
    apt update && apt install bazel -y

# Install gvisor syscall test binaries
WORKDIR /root
RUN git clone -b occlum-release-20200921.0 https://github.com/occlum/gvisor.git && \
    cd gvisor/occlum && \
    ./build_and_install_syscall_tests.sh && \
    cd /root && \
    mv gvisor/occlum gvisor_occlum && \
    rm -rf gvisor

WORKDIR /root
