Add support for building docker image with specific Occlum branch

This commit is contained in:
Hui, Chunyang 2020-11-19 09:57:40 +00:00 committed by Tate, Hongliang Tian
parent 4769a2600e
commit 9c3f595f0e
4 changed files with 18 additions and 3 deletions

@ -29,6 +29,11 @@ jobs:
id: get_version id: get_version
run: echo "RELEASE_VERSION=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV; run: echo "RELEASE_VERSION=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV;
- name: Get branch name
# GITHUB_REF=refs/heads/branch-name
# ${GITHUB_REF##*/} == branch-name
run: echo "OCCLUM_BRANCH=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV;
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1
@ -47,6 +52,7 @@ jobs:
context: . context: .
file: ./tools/docker/Dockerfile.centos8.1 file: ./tools/docker/Dockerfile.centos8.1
platforms: linux/amd64 platforms: linux/amd64
build-args: OCCLUM_BRANCH=${{ env.OCCLUM_BRANCH }}
push: true push: true
tags: occlum/occlum:${{ env.RELEASE_VERSION }}-centos8.1 tags: occlum/occlum:${{ env.RELEASE_VERSION }}-centos8.1
@ -69,6 +75,11 @@ jobs:
id: get_version id: get_version
run: echo "RELEASE_VERSION=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV; run: echo "RELEASE_VERSION=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV;
- name: Get branch name
# GITHUB_REF=refs/heads/branch-name
# ${GITHUB_REF##*/} == branch-name
run: echo "OCCLUM_BRANCH=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV;
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1
@ -87,5 +98,6 @@ jobs:
context: . context: .
file: ./tools/docker/Dockerfile.ubuntu18.04 file: ./tools/docker/Dockerfile.ubuntu18.04
platforms: linux/amd64 platforms: linux/amd64
build-args: OCCLUM_BRANCH=${{ env.OCCLUM_BRANCH }}
push: true push: true
tags: occlum/occlum:${{ env.RELEASE_VERSION }}-ubuntu18.04 tags: occlum/occlum:${{ env.RELEASE_VERSION }}-ubuntu18.04

@ -96,8 +96,9 @@ RUN cd java && ./install_dragonwell.sh && rm -rf /tmp/java
ENV PATH="/opt/occlum/toolchains/jvm/bin:$PATH" ENV PATH="/opt/occlum/toolchains/jvm/bin:$PATH"
# Install the latest version of Occlum # Install the latest version of Occlum
ARG OCCLUM_BRANCH
WORKDIR /root WORKDIR /root
RUN git clone https://github.com/occlum/occlum.git && \ RUN git clone -b $OCCLUM_BRANCH https://github.com/occlum/occlum && \
cd occlum && \ cd occlum && \
source /root/.bashrc && \ source /root/.bashrc && \
make submodule && \ make submodule && \

@ -108,8 +108,9 @@ RUN cd java && ./install_dragonwell.sh && rm -rf /tmp/java
ENV PATH="/opt/occlum/toolchains/jvm/bin:$PATH" ENV PATH="/opt/occlum/toolchains/jvm/bin:$PATH"
# Install the latest version of Occlum # Install the latest version of Occlum
ARG OCCLUM_BRANCH
WORKDIR /root WORKDIR /root
RUN git clone https://github.com/occlum/occlum && \ RUN git clone -b $OCCLUM_BRANCH https://github.com/occlum/occlum && \
cd occlum && \ cd occlum && \
make submodule && \ make submodule && \
OCCLUM_RELEASE_BUILD=1 make && \ OCCLUM_RELEASE_BUILD=1 make && \

@ -34,6 +34,7 @@ if [[ ( "$#" < 2 ) ]] ; then
report_error report_error
fi fi
occlum_branch=master
occlum_label=$1 occlum_label=$1
os_name=$2 os_name=$2
@ -46,4 +47,4 @@ function check_item_in_list() {
check_item_in_list "$os_name" "ubuntu18.04 centos7.5 centos8.1" || report_error check_item_in_list "$os_name" "ubuntu18.04 centos7.5 centos8.1" || report_error
cd "$script_dir/.." cd "$script_dir/.."
docker build -f "$script_dir/Dockerfile.$os_name" -t "occlum/occlum:$occlum_label-$os_name" . docker build -f "$script_dir/Dockerfile.$os_name" -t "occlum/occlum:$occlum_label-$os_name" --build-arg OCCLUM_BRANCH=$occlum_branch .