From 0f7ffb617e5abec9b040be9c3d2a914f634f63dc Mon Sep 17 00:00:00 2001 From: "Zheng, Qi" Date: Wed, 7 Jun 2023 14:39:04 +0800 Subject: [PATCH] [dockerfile] Clean up to reduce docker image size --- tools/docker/Dockerfile.anolis8.8 | 20 ++++++++++---------- tools/docker/Dockerfile.ubuntu20.04 | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tools/docker/Dockerfile.anolis8.8 b/tools/docker/Dockerfile.anolis8.8 index a3d700e7..0bc3dbcf 100644 --- a/tools/docker/Dockerfile.anolis8.8 +++ b/tools/docker/Dockerfile.anolis8.8 @@ -136,31 +136,31 @@ RUN git clone -b $OCCLUM_BRANCH https://github.com/occlum/occlum && \ # Install Occlum toolchain WORKDIR /root/occlum/tools/toolchains -RUN cd musl-gcc && ./build.sh && ./install_zlib.sh +RUN cd musl-gcc && ./build.sh && ./install_zlib.sh && cd .. && rm -rf musl-gcc ENV PATH="/opt/occlum/build/bin:/usr/local/occlum/bin:$PATH" # Install glibc WORKDIR /root/occlum/tools/toolchains -RUN cd glibc && ./build.sh +RUN cd glibc && ./build.sh && cd .. && rm -rf glibc # Install Occlum Golang toolchain WORKDIR /root/occlum/tools/toolchains -RUN cd golang && ./build.sh +RUN cd golang && ./build.sh && cd .. && rm -rf golang ENV PATH="/opt/occlum/toolchains/golang/bin:$PATH" # Install Occlum Rust toolchain WORKDIR /root/occlum/tools/toolchains -RUN cd rust && ./build.sh +RUN cd rust && ./build.sh && cd .. && rm -rf rust ENV PATH="/opt/occlum/toolchains/rust/bin:$PATH" ENV LD_LIBRARY_PATH="/opt/intel/sgxsdk/sdk_libs" # Install Occlum bash WORKDIR /root/occlum/tools/toolchains -RUN cd bash && ./build.sh +RUN cd bash && ./build.sh && cd .. && rm -rf bash # Install Occlum busybox WORKDIR /root/occlum/tools/toolchains -RUN cd busybox && ./build.sh +RUN cd busybox && ./build.sh && cd .. && rm -rf busybox # Install Occlum Java toolchain (JDK 11) ARG JDK11_PATH=/opt/occlum/toolchains/jvm/java-11-openjdk @@ -168,7 +168,7 @@ COPY --from=alpine /usr/lib/jvm/java-11-openjdk $JDK11_PATH RUN rm $JDK11_PATH/lib/security/cacerts COPY --from=alpine /etc/ssl/certs/java/cacerts $JDK11_PATH/lib/security/cacerts WORKDIR /root/occlum/tools/toolchains -RUN cd java && ./install_dragonwell.sh +RUN cd java && ./install_dragonwell.sh && cd .. && rm -rf java ENV PATH="/opt/occlum/toolchains/jvm/bin:$PATH" # Install OpenJDK 8 @@ -179,15 +179,15 @@ COPY --from=alpine /etc/ssl/certs/java/cacerts $JDK8_PATH/jre/lib/security/cacer # Install DCAP library WORKDIR /root/occlum/tools/toolchains -RUN cd dcap_lib && ./build.sh +RUN cd dcap_lib && ./build.sh && cd .. && rm -rf dcap_lib # Install AECS Client library WORKDIR /root/occlum/tools/toolchains -RUN cd aecs_client && ./build.sh +RUN cd aecs_client && ./build.sh && cd .. && rm -rf aecs_client # Install GRPC RATLS WORKDIR /root/occlum/tools/toolchains -RUN cd grpc_ratls && ./build.sh +RUN cd grpc_ratls && ./build.sh && cd .. && rm -rf grpc_ratls # Build and install Occlum WORKDIR /root diff --git a/tools/docker/Dockerfile.ubuntu20.04 b/tools/docker/Dockerfile.ubuntu20.04 index 1b05a5c7..b5810144 100644 --- a/tools/docker/Dockerfile.ubuntu20.04 +++ b/tools/docker/Dockerfile.ubuntu20.04 @@ -143,31 +143,31 @@ RUN git clone -b $OCCLUM_BRANCH https://github.com/occlum/occlum && \ # Install Occlum toolchain WORKDIR /root/occlum/tools/toolchains -RUN cd musl-gcc && ./build.sh && ./install_zlib.sh +RUN cd musl-gcc && ./build.sh && ./install_zlib.sh && cd .. && rm -rf musl-gcc ENV PATH="/opt/occlum/build/bin:/usr/local/occlum/bin:$PATH" # Install glibc WORKDIR /root/occlum/tools/toolchains -RUN cd glibc && ./build.sh +RUN cd glibc && ./build.sh && cd .. && rm -rf glibc # Install Occlum Golang toolchain WORKDIR /root/occlum/tools/toolchains -RUN cd golang && ./build.sh +RUN cd golang && ./build.sh && cd .. && rm -rf golang ENV PATH="/opt/occlum/toolchains/golang/bin:$PATH" # Install Occlum Rust toolchain WORKDIR /root/occlum/tools/toolchains -RUN cd rust && ./build.sh +RUN cd rust && ./build.sh && cd .. && rm -rf rust ENV PATH="/opt/occlum/toolchains/rust/bin:$PATH" ENV LD_LIBRARY_PATH="/opt/intel/sgxsdk/sdk_libs" # Install Occlum bash WORKDIR /root/occlum/tools/toolchains -RUN cd bash && ./build.sh +RUN cd bash && ./build.sh && cd .. && rm -rf bash # Install Occlum busybox WORKDIR /root/occlum/tools/toolchains -RUN cd busybox && ./build.sh +RUN cd busybox && ./build.sh && cd .. && rm -rf busybox # Install Occlum Java toolchain (JDK 11) ARG JDK11_PATH=/opt/occlum/toolchains/jvm/java-11-openjdk @@ -175,7 +175,7 @@ COPY --from=alpine /usr/lib/jvm/java-11-openjdk $JDK11_PATH RUN rm $JDK11_PATH/lib/security/cacerts COPY --from=alpine /etc/ssl/certs/java/cacerts $JDK11_PATH/lib/security/cacerts WORKDIR /root/occlum/tools/toolchains -RUN cd java && ./install_dragonwell.sh +RUN cd java && ./install_dragonwell.sh && cd .. && rm -rf java ENV PATH="/opt/occlum/toolchains/jvm/bin:$PATH" # Install OpenJDK 8 @@ -186,15 +186,15 @@ COPY --from=alpine /etc/ssl/certs/java/cacerts $JDK8_PATH/jre/lib/security/cacer # Install DCAP library WORKDIR /root/occlum/tools/toolchains -RUN cd dcap_lib && ./build.sh +RUN cd dcap_lib && ./build.sh && cd .. && rm -rf dcap_lib # Install AECS Client library WORKDIR /root/occlum/tools/toolchains -RUN cd aecs_client && ./build.sh +RUN cd aecs_client && ./build.sh && cd .. && rm -rf aecs_client # Install GRPC RATLS WORKDIR /root/occlum/tools/toolchains -RUN cd grpc_ratls && ./build.sh +RUN cd grpc_ratls && ./build.sh && cd .. && rm -rf grpc_ratls # Install Occlum WORKDIR /root