[Dockerfile] Update toolchains build

This commit is contained in:
Zheng, Qi 2023-05-24 11:20:18 +08:00 committed by volcano
parent 198515ab90
commit 88d512586c
3 changed files with 54 additions and 39 deletions

@ -42,8 +42,6 @@ submodule: githooks init-submodule
@cp deps/sefs/sefs-cli/lib/libsefs-cli_sim.so build/lib @cp deps/sefs/sefs-cli/lib/libsefs-cli_sim.so build/lib
@cp deps/sefs/sefs-cli/lib/libsefs-cli.signed.so build/lib @cp deps/sefs/sefs-cli/lib/libsefs-cli.signed.so build/lib
@cp deps/sefs/sefs-cli/enclave/Enclave.config.xml build/sefs-cli.Enclave.xml @cp deps/sefs/sefs-cli/enclave/Enclave.config.xml build/sefs-cli.Enclave.xml
@# Build and install Occlum dcap lib
@cd tools/toolchains/dcap_lib && ./build.sh
else else
submodule: githooks init-submodule submodule: githooks init-submodule
@rm -rf build @rm -rf build

@ -130,44 +130,45 @@ RUN wget http://www.etallen.com/cpuid/cpuid-20200211.x86_64.tar.gz && \
ARG OCCLUM_BRANCH ARG OCCLUM_BRANCH
WORKDIR /root WORKDIR /root
RUN git clone -b $OCCLUM_BRANCH https://github.com/occlum/occlum && \ RUN git clone -b $OCCLUM_BRANCH https://github.com/occlum/occlum && \
cp -r /root/occlum/tools/toolchains/* /tmp/ && mkdir -p /opt/occlum/ && \ cd /root/occlum && git submodule update --init && \
mkdir -p /opt/occlum/ && \
cp /root/occlum/tools/docker/start_aesm.sh /opt/occlum/ cp /root/occlum/tools/docker/start_aesm.sh /opt/occlum/
# Install Occlum toolchain # Install Occlum toolchain
WORKDIR /tmp WORKDIR /root/occlum/tools/toolchains
RUN cd musl-gcc && ./build.sh && ./install_zlib.sh && rm -rf /tmp/musl-gcc RUN cd musl-gcc && ./build.sh && ./install_zlib.sh
ENV PATH="/opt/occlum/build/bin:/usr/local/occlum/bin:$PATH" ENV PATH="/opt/occlum/build/bin:/usr/local/occlum/bin:$PATH"
# Install glibc # Install glibc
WORKDIR /tmp WORKDIR /root/occlum/tools/toolchains
RUN cd glibc && ./build.sh && rm -rf /tmp/glibc RUN cd glibc && ./build.sh
# Install Occlum Golang toolchain # Install Occlum Golang toolchain
WORKDIR /tmp WORKDIR /root/occlum/tools/toolchains
RUN cd golang && ./build.sh && rm -rf /tmp/golang RUN cd golang && ./build.sh
ENV PATH="/opt/occlum/toolchains/golang/bin:$PATH" ENV PATH="/opt/occlum/toolchains/golang/bin:$PATH"
# Install Occlum Rust toolchain # Install Occlum Rust toolchain
WORKDIR /tmp WORKDIR /root/occlum/tools/toolchains
RUN cd rust && ./build.sh && rm -rf /tmp/rust RUN cd rust && ./build.sh
ENV PATH="/opt/occlum/toolchains/rust/bin:$PATH" ENV PATH="/opt/occlum/toolchains/rust/bin:$PATH"
ENV LD_LIBRARY_PATH="/opt/intel/sgxsdk/sdk_libs" ENV LD_LIBRARY_PATH="/opt/intel/sgxsdk/sdk_libs"
# Install Occlum bash # Install Occlum bash
WORKDIR /tmp WORKDIR /root/occlum/tools/toolchains
RUN cd bash && ./build.sh && rm -rf /tmp/bash RUN cd bash && ./build.sh
# Install Occlum busybox # Install Occlum busybox
WORKDIR /tmp WORKDIR /root/occlum/tools/toolchains
RUN cd busybox && ./build.sh && rm -rf /tmp/busybox RUN cd busybox && ./build.sh
# Install Occlum Java toolchain (JDK 11) # Install Occlum Java toolchain (JDK 11)
ARG JDK11_PATH=/opt/occlum/toolchains/jvm/java-11-openjdk ARG JDK11_PATH=/opt/occlum/toolchains/jvm/java-11-openjdk
COPY --from=alpine /usr/lib/jvm/java-11-openjdk $JDK11_PATH COPY --from=alpine /usr/lib/jvm/java-11-openjdk $JDK11_PATH
RUN rm $JDK11_PATH/lib/security/cacerts RUN rm $JDK11_PATH/lib/security/cacerts
COPY --from=alpine /etc/ssl/certs/java/cacerts $JDK11_PATH/lib/security/cacerts COPY --from=alpine /etc/ssl/certs/java/cacerts $JDK11_PATH/lib/security/cacerts
WORKDIR /tmp WORKDIR /root/occlum/tools/toolchains
RUN cd java && ./install_dragonwell.sh && rm -rf /tmp/java RUN cd java && ./install_dragonwell.sh
ENV PATH="/opt/occlum/toolchains/jvm/bin:$PATH" ENV PATH="/opt/occlum/toolchains/jvm/bin:$PATH"
# Install OpenJDK 8 # Install OpenJDK 8
@ -176,6 +177,18 @@ COPY --from=alpine /usr/lib/jvm/java-1.8-openjdk $JDK8_PATH
RUN rm $JDK8_PATH/jre/lib/security/cacerts RUN rm $JDK8_PATH/jre/lib/security/cacerts
COPY --from=alpine /etc/ssl/certs/java/cacerts $JDK8_PATH/jre/lib/security/cacerts COPY --from=alpine /etc/ssl/certs/java/cacerts $JDK8_PATH/jre/lib/security/cacerts
# Install DCAP library
WORKDIR /root/occlum/tools/toolchains
RUN cd dcap_lib && ./build.sh
# Install AECS Client library
WORKDIR /root/occlum/tools/toolchains
RUN cd aecs_client && ./build.sh
# Install GRPC RATLS
WORKDIR /root/occlum/tools/toolchains
RUN cd grpc_ratls && ./build.sh
# Build and install Occlum # Build and install Occlum
WORKDIR /root WORKDIR /root
RUN cd occlum && \ RUN cd occlum && \

@ -137,44 +137,45 @@ RUN git clone -b sgx_2.17.1_for_occlum https://github.com/occlum/linux-sgx && \
ARG OCCLUM_BRANCH ARG OCCLUM_BRANCH
WORKDIR /root WORKDIR /root
RUN git clone -b $OCCLUM_BRANCH https://github.com/occlum/occlum && \ RUN git clone -b $OCCLUM_BRANCH https://github.com/occlum/occlum && \
cp -r /root/occlum/tools/toolchains/* /tmp/ && mkdir -p /opt/occlum/ && \ cd /root/occlum && git submodule update --init && \
mkdir -p /opt/occlum/ && \
cp /root/occlum/tools/docker/start_aesm.sh /opt/occlum/ cp /root/occlum/tools/docker/start_aesm.sh /opt/occlum/
# Install Occlum toolchain # Install Occlum toolchain
WORKDIR /tmp WORKDIR /root/occlum/tools/toolchains
RUN cd musl-gcc && ./build.sh && ./install_zlib.sh && rm -rf /tmp/musl-gcc RUN cd musl-gcc && ./build.sh && ./install_zlib.sh
ENV PATH="/opt/occlum/build/bin:/usr/local/occlum/bin:$PATH" ENV PATH="/opt/occlum/build/bin:/usr/local/occlum/bin:$PATH"
# Install glibc # Install glibc
WORKDIR /tmp WORKDIR /root/occlum/tools/toolchains
RUN cd glibc && ./build.sh && rm -rf /tmp/glibc RUN cd glibc && ./build.sh
# Install Occlum Golang toolchain # Install Occlum Golang toolchain
WORKDIR /tmp WORKDIR /root/occlum/tools/toolchains
RUN cd golang && ./build.sh && rm -rf /tmp/golang RUN cd golang && ./build.sh
ENV PATH="/opt/occlum/toolchains/golang/bin:$PATH" ENV PATH="/opt/occlum/toolchains/golang/bin:$PATH"
# Install Occlum Rust toolchain # Install Occlum Rust toolchain
WORKDIR /tmp WORKDIR /root/occlum/tools/toolchains
RUN cd rust && ./build.sh && rm -rf /tmp/rust RUN cd rust && ./build.sh
ENV PATH="/opt/occlum/toolchains/rust/bin:$PATH" ENV PATH="/opt/occlum/toolchains/rust/bin:$PATH"
ENV LD_LIBRARY_PATH="/opt/intel/sgxsdk/sdk_libs" ENV LD_LIBRARY_PATH="/opt/intel/sgxsdk/sdk_libs"
# Install Occlum bash # Install Occlum bash
WORKDIR /tmp WORKDIR /root/occlum/tools/toolchains
RUN cd bash && ./build.sh && rm -rf /tmp/bash RUN cd bash && ./build.sh
# Install Occlum busybox # Install Occlum busybox
WORKDIR /tmp WORKDIR /root/occlum/tools/toolchains
RUN cd busybox && ./build.sh && rm -rf /tmp/busybox RUN cd busybox && ./build.sh
# Install Occlum Java toolchain (JDK 11) # Install Occlum Java toolchain (JDK 11)
ARG JDK11_PATH=/opt/occlum/toolchains/jvm/java-11-openjdk ARG JDK11_PATH=/opt/occlum/toolchains/jvm/java-11-openjdk
COPY --from=alpine /usr/lib/jvm/java-11-openjdk $JDK11_PATH COPY --from=alpine /usr/lib/jvm/java-11-openjdk $JDK11_PATH
RUN rm $JDK11_PATH/lib/security/cacerts RUN rm $JDK11_PATH/lib/security/cacerts
COPY --from=alpine /etc/ssl/certs/java/cacerts $JDK11_PATH/lib/security/cacerts COPY --from=alpine /etc/ssl/certs/java/cacerts $JDK11_PATH/lib/security/cacerts
WORKDIR /tmp WORKDIR /root/occlum/tools/toolchains
RUN cd java && ./install_dragonwell.sh && rm -rf /tmp/java RUN cd java && ./install_dragonwell.sh
ENV PATH="/opt/occlum/toolchains/jvm/bin:$PATH" ENV PATH="/opt/occlum/toolchains/jvm/bin:$PATH"
# Install OpenJDK 8 # Install OpenJDK 8
@ -183,9 +184,17 @@ COPY --from=alpine /usr/lib/jvm/java-1.8-openjdk $JDK8_PATH
RUN rm $JDK8_PATH/jre/lib/security/cacerts RUN rm $JDK8_PATH/jre/lib/security/cacerts
COPY --from=alpine /etc/ssl/certs/java/cacerts $JDK8_PATH/jre/lib/security/cacerts COPY --from=alpine /etc/ssl/certs/java/cacerts $JDK8_PATH/jre/lib/security/cacerts
# Install DCAP library
WORKDIR /root/occlum/tools/toolchains
RUN cd dcap_lib && ./build.sh
# Install AECS Client library # Install AECS Client library
WORKDIR /tmp WORKDIR /root/occlum/tools/toolchains
RUN cd aecs_client && ./build.sh && rm -rf /tmp/aecs_client RUN cd aecs_client && ./build.sh
# Install GRPC RATLS
WORKDIR /root/occlum/tools/toolchains
RUN cd grpc_ratls && ./build.sh
# Install Occlum # Install Occlum
WORKDIR /root WORKDIR /root
@ -197,11 +206,6 @@ RUN cd occlum && \
cp -r demos /root/demos && \ cp -r demos /root/demos && \
rm -rf /root/occlum rm -rf /root/occlum
# Install GRPC RATLS
# Do after installing Occlum is because it depends on the dcap library.
WORKDIR /tmp
RUN cd grpc_ratls && ./build.sh && rm -rf /tmp/grpc_ratls
# Start AESM service automatically # Start AESM service automatically
# #
# To do so, we add the script to ~/.bashrc. We cannot use systemd to run AESM # To do so, we add the script to ~/.bashrc. We cannot use systemd to run AESM