Support building CI image for different branches

This commit is contained in:
Hui, Chunyang 2021-09-27 07:44:48 +00:00 committed by Zongmin.Gu
parent a01b35ff5e
commit edaf2374b0
3 changed files with 31 additions and 5 deletions

@ -48,6 +48,8 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=104857600
- name: Login to DockerHub
uses: docker/login-action@v1
@ -89,6 +91,8 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=104857600
- name: Login to DockerHub
uses: docker/login-action@v1
@ -102,7 +106,9 @@ jobs:
context: .
file: ./tools/docker/ci/Dockerfile.gvisor_test
platforms: linux/amd64
build-args: OCCLUM_VERSION=${{ env.OCCLUM_VERSION }}
build-args: |
"OCCLUM_VERSION=${{ env.OCCLUM_VERSION }}"
"OCCLUM_BRANCH=${{ env.OCCLUM_BRANCH }}"
push: true
tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-gvisor_test
@ -118,6 +124,11 @@ jobs:
- name: Get occlum version
run: echo "OCCLUM_VERSION=$(grep 'Version =' src/pal/include/occlum_version.h | awk '{print $4}')" >> $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;
# Because "Build and push" step `context` field can't be subdir,
# we need to copy files needed by dockerfile to root dir of the project
- name: Copy context for docker build
@ -128,6 +139,8 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=104857600
- name: Login to DockerHub
uses: docker/login-action@v1
@ -141,7 +154,9 @@ jobs:
context: .
file: ./tools/docker/ci/Dockerfile.openvino
platforms: linux/amd64
build-args: OCCLUM_VERSION=${{ env.OCCLUM_VERSION }}
build-args: |
"OCCLUM_VERSION=${{ env.OCCLUM_VERSION }}"
"OCCLUM_BRANCH=${{ env.OCCLUM_BRANCH }}"
push: true
tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-openvino
@ -157,6 +172,11 @@ jobs:
- name: Get occlum version
run: echo "OCCLUM_VERSION=$(grep 'Version =' src/pal/include/occlum_version.h | awk '{print $4}')" >> $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;
# Because "Build and push" step `context` field can't be subdir,
# we need to copy files needed by dockerfile to root dir of the project
- name: Copy context for docker build
@ -167,6 +187,8 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=104857600
- name: Login to DockerHub
uses: docker/login-action@v1
@ -180,7 +202,9 @@ jobs:
context: .
file: ./tools/docker/ci/Dockerfile.python
platforms: linux/amd64
build-args: OCCLUM_VERSION=${{ env.OCCLUM_VERSION }}
build-args: |
"OCCLUM_VERSION=${{ env.OCCLUM_VERSION }}"
"OCCLUM_BRANCH=${{ env.OCCLUM_BRANCH }}"
push: true
tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-python
@ -212,6 +236,8 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=104857600
- name: Login to DockerHub
uses: docker/login-action@v1

@ -2,9 +2,10 @@ ARG OCCLUM_VERSION
FROM occlum/occlum:$OCCLUM_VERSION-ubuntu18.04 as base
LABEL maintainer="Chunyang Hui <sanqian.hcy@antgroup.com>"
ARG OCCLUM_BRANCH
WORKDIR /root
RUN rm -rf /root/demos && \
git clone https://github.com/occlum/occlum.git && \
git clone -b $OCCLUM_BRANCH https://github.com/occlum/occlum.git && \
cp -r occlum/demos /root/demos && \
rm -rf /root/occlum

@ -4,7 +4,6 @@ FROM python:3.7-alpine3.10 as alpine
RUN apk add g++ lapack-dev gfortran && \
pip3 install numpy pandas scipy==1.3.1 Cython scikit-learn==0.21.1
FROM occlum/occlum:$OCCLUM_VERSION-ubuntu18.04 as base
LABEL maintainer="Chunyang Hui <sanqian.hcy@antgroup.com>"