Add aliyunlinux 3 docker image support
This commit is contained in:
parent
affa17482a
commit
04c3f485dc
20
.github/workflows/build_and_push_alinux2_image.yml → .github/workflows/build_and_push_aliyunlinux_image.yml
vendored
20
.github/workflows/build_and_push_alinux2_image.yml → .github/workflows/build_and_push_aliyunlinux_image.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Alinux2 Docker Build and Push
|
name: Aliyunlinux Docker Build and Push
|
||||||
|
|
||||||
# This is a manual trigger.
|
# This is a manual trigger.
|
||||||
on:
|
on:
|
||||||
@ -10,7 +10,7 @@ on:
|
|||||||
default: 'N'
|
default: 'N'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
generate-alinux2-image:
|
generate-aliyunlinux-image:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
if: github.event.inputs.only_test == 'N'
|
if: github.event.inputs.only_test == 'N'
|
||||||
|
|
||||||
@ -51,16 +51,16 @@ jobs:
|
|||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./tools/docker/Dockerfile.aliyunlinux
|
file: ./tools/docker/Dockerfile.aliyunlinux3
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
build-args: OCCLUM_BRANCH=${{ env.OCCLUM_BRANCH }}
|
build-args: OCCLUM_BRANCH=${{ env.OCCLUM_BRANCH }}
|
||||||
push: true
|
push: true
|
||||||
tags: occlum/occlum:${{ env.RELEASE_VERSION }}-aliyunlinux
|
tags: occlum/occlum:${{ env.RELEASE_VERSION }}-aliyunlinux
|
||||||
|
|
||||||
|
|
||||||
Make_test_on_alinux2:
|
Make_test_on_aliyunlinux:
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
needs: generate-alinux2-image
|
needs: generate-aliyunlinux-image
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@ -72,16 +72,16 @@ jobs:
|
|||||||
run: echo "OCCLUM_VERSION=$(grep 'Version =' src/pal/include/occlum_version.h | awk '{print $4}')" >> $GITHUB_ENV;
|
run: echo "OCCLUM_VERSION=$(grep 'Version =' src/pal/include/occlum_version.h | awk '{print $4}')" >> $GITHUB_ENV;
|
||||||
|
|
||||||
- name: Create container with Aliyun Linux image
|
- name: Create container with Aliyun Linux image
|
||||||
run: docker run -itd --name=alinux2-test -v $GITHUB_WORKSPACE:/root/occlum occlum/occlum:${{ env.OCCLUM_VERSION }}-aliyunlinux
|
run: docker run -itd --name=alinux-test -v $GITHUB_WORKSPACE:/root/occlum occlum/occlum:${{ env.OCCLUM_VERSION }}-aliyunlinux
|
||||||
|
|
||||||
- name: Build dependencies
|
- name: Build dependencies
|
||||||
run: docker exec alinux2-test bash -c "cd /root/occlum; make submodule"
|
run: docker exec alinux-test bash -c "cd /root/occlum; make submodule"
|
||||||
|
|
||||||
- name: Build source
|
- name: Build source
|
||||||
run: docker exec alinux2-test bash -c "source /opt/intel/sgxsdk/environment; cd /root/occlum; OCCLUM_RELEASE_BUILD=y SGX_MODE=SIM make"
|
run: docker exec alinux-test bash -c "source /opt/intel/sgxsdk/environment; cd /root/occlum; OCCLUM_RELEASE_BUILD=y SGX_MODE=SIM make"
|
||||||
|
|
||||||
- name: Integration test
|
- name: Integration test
|
||||||
run: docker exec alinux2-test bash -c "cd /root/occlum; OCCLUM_LOG_LEVEL=trace SGX_MODE=SIM make test"
|
run: docker exec alinux-test bash -c "cd /root/occlum; OCCLUM_LOG_LEVEL=trace SGX_MODE=SIM make test"
|
||||||
|
|
||||||
- name: Integration test with Glibc
|
- name: Integration test with Glibc
|
||||||
run: docker exec alinux2-test bash -c "cd /root/occlum; OCCLUM_LOG_LEVEL=trace SGX_MODE=SIM make test-glibc"
|
run: docker exec alinux-test bash -c "cd /root/occlum; OCCLUM_LOG_LEVEL=trace SGX_MODE=SIM make test-glibc"
|
187
tools/docker/Dockerfile.aliyunlinux3
Normal file
187
tools/docker/Dockerfile.aliyunlinux3
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
FROM alpine:3.11 AS alpine
|
||||||
|
|
||||||
|
RUN apk update && \
|
||||||
|
apk --no-cache add openjdk11 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
|
||||||
|
|
||||||
|
FROM registry.cn-hangzhou.aliyuncs.com/alinux/alinux3
|
||||||
|
|
||||||
|
LABEL maintainer="Chunyang Hui <sanqian.hcy@antgroup.com>"
|
||||||
|
|
||||||
|
#The default shell for the RUN instruction is ["/bin/sh", "-c"], which sometimes cause unexpected error
|
||||||
|
#for example "source a_file". Use bash as default shell instead.
|
||||||
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
|
||||||
|
RUN yum install -y --nogpgcheck \
|
||||||
|
alinux-release-experimentals && \
|
||||||
|
yum install -y --nogpgcheck \
|
||||||
|
astyle \
|
||||||
|
autoconf \
|
||||||
|
automake \
|
||||||
|
bison \
|
||||||
|
bzip2 \
|
||||||
|
boost-devel \
|
||||||
|
ca-certificates \
|
||||||
|
cmake \
|
||||||
|
curl \
|
||||||
|
curl-devel \
|
||||||
|
createrepo \
|
||||||
|
expect \
|
||||||
|
expat \
|
||||||
|
expat-devel \
|
||||||
|
gettext \
|
||||||
|
file \
|
||||||
|
fuse-devel \
|
||||||
|
fuse-libs \
|
||||||
|
gawk \
|
||||||
|
gcc \
|
||||||
|
gcc-c++ \
|
||||||
|
glibc-headers \
|
||||||
|
gdb \
|
||||||
|
git-core \
|
||||||
|
gmp-devel \
|
||||||
|
golang \
|
||||||
|
jq \
|
||||||
|
libmpc-devel \
|
||||||
|
libxml2-devel \
|
||||||
|
libtool \
|
||||||
|
pkgconfig \
|
||||||
|
python \
|
||||||
|
kmod \
|
||||||
|
make \
|
||||||
|
mod_ssl \
|
||||||
|
mpfr-devel \
|
||||||
|
ocaml \
|
||||||
|
ocaml-ocamlbuild \
|
||||||
|
openssl \
|
||||||
|
openssl-devel \
|
||||||
|
patch \
|
||||||
|
python3 \
|
||||||
|
sudo \
|
||||||
|
uuid-devel \
|
||||||
|
vim \
|
||||||
|
wget \
|
||||||
|
yum-utils \
|
||||||
|
rpm-build \
|
||||||
|
git \
|
||||||
|
protobuf \
|
||||||
|
protobuf-c \
|
||||||
|
protobuf-compiler \
|
||||||
|
protobuf-c-compiler \
|
||||||
|
protobuf-c-devel \
|
||||||
|
protobuf-devel && \
|
||||||
|
yum groupinstall -y 'Development Tools' && \
|
||||||
|
yum clean all && \
|
||||||
|
alternatives --set python /usr/bin/python3
|
||||||
|
|
||||||
|
# Aliyunlinux3 use GCC 10 as default toolchain
|
||||||
|
|
||||||
|
# Install PSW and DCAP RPM packages
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN wget https://mirrors.openanolis.org/inclavare-containers/alinux3/sgx_rpm_local_repo.tar.gz && \
|
||||||
|
tar -xzf sgx_rpm_local_repo.tar.gz && \
|
||||||
|
rm -f sgx_rpm_local_repo.tar.gz && \
|
||||||
|
cd /tmp/sgx_rpm_local_repo && \
|
||||||
|
rpm -ivh --nodeps libsgx-ae-pce*.rpm \
|
||||||
|
libsgx-headers*.rpm \
|
||||||
|
libsgx-ae-qe3*.rpm \
|
||||||
|
libsgx-ae-qve*.rpm \
|
||||||
|
libsgx-enclave-common*.rpm \
|
||||||
|
libsgx-quote-ex*.rpm \
|
||||||
|
libsgx-urts*.rpm \
|
||||||
|
libsgx-dcap-ql*.rpm \
|
||||||
|
libsgx-qe3-logic*.rpm \
|
||||||
|
libsgx-pce-logic*.rpm \
|
||||||
|
libsgx-dcap-quote-verify*.rpm \
|
||||||
|
libsgx-dcap-ql*.rpm \
|
||||||
|
libsgx-dcap-ql-dev*.rpm \
|
||||||
|
libsgx-dcap-default-qpl*.rpm \
|
||||||
|
libsgx-dcap-default-qpl-dev*.rpm \
|
||||||
|
libsgx-dcap-quote-verify-dev*.rpm \
|
||||||
|
libsgx-uae-service*.rpm \
|
||||||
|
libsgx-epid*.rpm \
|
||||||
|
libsgx-launch*.rpm \
|
||||||
|
libsgx-ae-le-*.rpm \
|
||||||
|
libsgx-aesm-launch-plugin-*.rpm \
|
||||||
|
sgx-aesm-service*.rpm && \
|
||||||
|
rm -rf /tmp/sgx_rpm_local_repo
|
||||||
|
|
||||||
|
# Install SGX SDK
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN git clone -b sgx_2.13.3_for_occlum https://github.com/occlum/linux-sgx && \
|
||||||
|
cd linux-sgx && \
|
||||||
|
make preparation && \
|
||||||
|
./compile_and_install.sh no_mitigation USE_OPT_LIBS=2 && \
|
||||||
|
echo 'source /opt/intel/sgxsdk/environment' >> /root/.bashrc && \
|
||||||
|
rm -rf /tmp/linux-sgx
|
||||||
|
|
||||||
|
# Install cpuid tool for tests
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN wget http://www.etallen.com/cpuid/cpuid-20200211.x86_64.tar.gz && \
|
||||||
|
tar -xf ./cpuid-20200211.x86_64.tar.gz && \
|
||||||
|
cp ./cpuid-20200211/cpuid /usr/bin/ && \
|
||||||
|
rm -rf /tmp/cpuid-20200211*
|
||||||
|
|
||||||
|
# Install Occlum toolchain
|
||||||
|
COPY toolchains/musl-gcc /tmp/musl-gcc
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN cd musl-gcc && ./build.sh && ./install_zlib.sh && rm -rf /tmp/musl-gcc
|
||||||
|
ENV PATH="/opt/occlum/build/bin:/usr/local/occlum/bin:$PATH"
|
||||||
|
|
||||||
|
# Install glibc
|
||||||
|
COPY toolchains/glibc /tmp/glibc
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN cd glibc && ./build.sh && rm -rf /tmp/glibc
|
||||||
|
|
||||||
|
# Install Occlum Golang toolchain
|
||||||
|
COPY toolchains/golang /tmp/golang
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN yum install -y go && cd golang && ./build.sh && rm -rf /tmp/golang
|
||||||
|
ENV PATH="/usr/local/occlum/golang/bin:$PATH"
|
||||||
|
|
||||||
|
# Install Occlum Java toolchain (JDK 11)
|
||||||
|
ARG JDK11_PATH=/opt/occlum/toolchains/jvm/java-11-openjdk
|
||||||
|
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
|
||||||
|
COPY toolchains/java /tmp/java
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN cd java && ./install_dragonwell.sh && rm -rf /tmp/java
|
||||||
|
ENV PATH="/opt/occlum/toolchains/jvm/bin:$PATH"
|
||||||
|
|
||||||
|
# Install Rust
|
||||||
|
ENV PATH="/root/.cargo/bin:$PATH"
|
||||||
|
ENV OCCLUM_RUST_VERSION=nightly-2020-10-25
|
||||||
|
RUN curl https://sh.rustup.rs -sSf | \
|
||||||
|
sh -s -- --default-toolchain ${OCCLUM_RUST_VERSION} -y && \
|
||||||
|
rm -rf /root/.cargo/registry && rm -rf /root/.cargo/git && \
|
||||||
|
cargo -V
|
||||||
|
|
||||||
|
# Install Occlum Rust toolchain
|
||||||
|
COPY toolchains/rust /tmp/rust
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN cd rust && ./build.sh && rm -rf /tmp/rust
|
||||||
|
ENV PATH="/opt/occlum/toolchains/rust/bin:$PATH"
|
||||||
|
|
||||||
|
ARG OCCLUM_BRANCH
|
||||||
|
ENV LD_LIBRARY_PATH="/opt/intel/sgxpsw/aesm:/usr/lib64/:/usr/local/lib:/opt/intel/sgxsdk/sdk_libs:/usr/lib:$LD_LIBRARY_PATH"
|
||||||
|
# Install the latest version of Occlum
|
||||||
|
WORKDIR /root/occlum
|
||||||
|
RUN rm -rf occlum && \
|
||||||
|
source scl_source enable devtoolset-8 && \
|
||||||
|
git clone -b $OCCLUM_BRANCH https://github.com/occlum/occlum && \
|
||||||
|
cd occlum && \
|
||||||
|
source /opt/intel/sgxsdk/environment && \
|
||||||
|
make submodule && \
|
||||||
|
OCCLUM_RELEASE_BUILD=1 make install && \
|
||||||
|
cp -r demos /root/demos && \
|
||||||
|
rm -rf /root/occlum
|
||||||
|
|
||||||
|
# Start AESM service automatically
|
||||||
|
#
|
||||||
|
# To do so, we add the script to ~/.bashrc. We cannot use systemd to run AESM
|
||||||
|
# as a "real" service since the pid 1 is not systemd in Docker. So we start
|
||||||
|
# up AESM service when an user login with an interative shell.
|
||||||
|
COPY docker/start_aesm.sh /opt/occlum/
|
||||||
|
RUN mkdir -p /var/run/aesmd && echo 'sudo /opt/occlum/start_aesm.sh' >> /root/.bashrc
|
||||||
|
|
||||||
|
WORKDIR /root
|
@ -3,6 +3,12 @@ SRC_DIR=/tmp/glibc/glibc
|
|||||||
BUILD_DIR=/tmp/glibc/glibc_build
|
BUILD_DIR=/tmp/glibc/glibc_build
|
||||||
INSTALL_DIR=/opt/occlum/glibc
|
INSTALL_DIR=/opt/occlum/glibc
|
||||||
|
|
||||||
|
# GCC 10 introduces many new checkings and will cause the build to fail.
|
||||||
|
if [ "$(gcc -dumpversion)" = "10" ]; then
|
||||||
|
EXTRA_CFLAGS=-fcommon
|
||||||
|
EXTRA_CONFIG_OPTION="--disable-werror"
|
||||||
|
fi
|
||||||
|
|
||||||
# Exit if any command fails
|
# Exit if any command fails
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@ -20,8 +26,8 @@ mkdir -p ${BUILD_DIR}
|
|||||||
cd ${BUILD_DIR}
|
cd ${BUILD_DIR}
|
||||||
# Build and install glibc
|
# Build and install glibc
|
||||||
unset LD_LIBRARY_PATH
|
unset LD_LIBRARY_PATH
|
||||||
CFLAGS="-O2 -g" ${SRC_DIR}/configure \
|
CFLAGS="-O2 -g ${EXTRA_CFLAGS}" ${SRC_DIR}/configure \
|
||||||
--prefix=${INSTALL_DIR} --with-tls --without-selinux \
|
--prefix=${INSTALL_DIR} --with-tls --without-selinux \
|
||||||
--enable-stack-protector=strong --disable-nscd
|
--enable-stack-protector=strong --disable-nscd ${EXTRA_CONFIG_OPTION}
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
|
Loading…
Reference in New Issue
Block a user