Support building CI image for different branches
This commit is contained in:
		
							parent
							
								
									a01b35ff5e
								
							
						
					
					
						commit
						edaf2374b0
					
				
							
								
								
									
										32
									
								
								.github/workflows/build_and_push_ci_image.yml
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										32
									
								
								.github/workflows/build_and_push_ci_image.yml
									
									
									
									
										vendored
									
									
								
							| @ -48,6 +48,8 @@ jobs: | |||||||
| 
 | 
 | ||||||
|     - name: Set up Docker Buildx |     - name: Set up Docker Buildx | ||||||
|       uses: docker/setup-buildx-action@v1 |       uses: docker/setup-buildx-action@v1 | ||||||
|  |       with: | ||||||
|  |           driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=104857600 | ||||||
| 
 | 
 | ||||||
|     - name: Login to DockerHub |     - name: Login to DockerHub | ||||||
|       uses: docker/login-action@v1 |       uses: docker/login-action@v1 | ||||||
| @ -89,6 +91,8 @@ jobs: | |||||||
| 
 | 
 | ||||||
|     - name: Set up Docker Buildx |     - name: Set up Docker Buildx | ||||||
|       uses: docker/setup-buildx-action@v1 |       uses: docker/setup-buildx-action@v1 | ||||||
|  |       with: | ||||||
|  |           driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=104857600 | ||||||
| 
 | 
 | ||||||
|     - name: Login to DockerHub |     - name: Login to DockerHub | ||||||
|       uses: docker/login-action@v1 |       uses: docker/login-action@v1 | ||||||
| @ -102,7 +106,9 @@ jobs: | |||||||
|         context: . |         context: . | ||||||
|         file: ./tools/docker/ci/Dockerfile.gvisor_test |         file: ./tools/docker/ci/Dockerfile.gvisor_test | ||||||
|         platforms: linux/amd64 |         platforms: linux/amd64 | ||||||
|         build-args: OCCLUM_VERSION=${{ env.OCCLUM_VERSION }} |         build-args: | | ||||||
|  |           "OCCLUM_VERSION=${{ env.OCCLUM_VERSION }}" | ||||||
|  |           "OCCLUM_BRANCH=${{ env.OCCLUM_BRANCH }}" | ||||||
|         push: true |         push: true | ||||||
|         tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-gvisor_test |         tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-gvisor_test | ||||||
| 
 | 
 | ||||||
| @ -118,6 +124,11 @@ jobs: | |||||||
|     - name: Get occlum version |     - name: Get occlum version | ||||||
|       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: 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, |     # 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 |     # we need to copy files needed by dockerfile to root dir of the project | ||||||
|     - name: Copy context for docker build |     - name: Copy context for docker build | ||||||
| @ -128,6 +139,8 @@ jobs: | |||||||
| 
 | 
 | ||||||
|     - name: Set up Docker Buildx |     - name: Set up Docker Buildx | ||||||
|       uses: docker/setup-buildx-action@v1 |       uses: docker/setup-buildx-action@v1 | ||||||
|  |       with: | ||||||
|  |           driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=104857600 | ||||||
| 
 | 
 | ||||||
|     - name: Login to DockerHub |     - name: Login to DockerHub | ||||||
|       uses: docker/login-action@v1 |       uses: docker/login-action@v1 | ||||||
| @ -141,7 +154,9 @@ jobs: | |||||||
|         context: . |         context: . | ||||||
|         file: ./tools/docker/ci/Dockerfile.openvino |         file: ./tools/docker/ci/Dockerfile.openvino | ||||||
|         platforms: linux/amd64 |         platforms: linux/amd64 | ||||||
|         build-args: OCCLUM_VERSION=${{ env.OCCLUM_VERSION }} |         build-args: | | ||||||
|  |           "OCCLUM_VERSION=${{ env.OCCLUM_VERSION }}" | ||||||
|  |           "OCCLUM_BRANCH=${{ env.OCCLUM_BRANCH }}" | ||||||
|         push: true |         push: true | ||||||
|         tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-openvino |         tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-openvino | ||||||
| 
 | 
 | ||||||
| @ -157,6 +172,11 @@ jobs: | |||||||
|     - name: Get occlum version |     - name: Get occlum version | ||||||
|       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: 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, |     # 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 |     # we need to copy files needed by dockerfile to root dir of the project | ||||||
|     - name: Copy context for docker build |     - name: Copy context for docker build | ||||||
| @ -167,6 +187,8 @@ jobs: | |||||||
| 
 | 
 | ||||||
|     - name: Set up Docker Buildx |     - name: Set up Docker Buildx | ||||||
|       uses: docker/setup-buildx-action@v1 |       uses: docker/setup-buildx-action@v1 | ||||||
|  |       with: | ||||||
|  |           driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=104857600 | ||||||
| 
 | 
 | ||||||
|     - name: Login to DockerHub |     - name: Login to DockerHub | ||||||
|       uses: docker/login-action@v1 |       uses: docker/login-action@v1 | ||||||
| @ -180,7 +202,9 @@ jobs: | |||||||
|         context: . |         context: . | ||||||
|         file: ./tools/docker/ci/Dockerfile.python |         file: ./tools/docker/ci/Dockerfile.python | ||||||
|         platforms: linux/amd64 |         platforms: linux/amd64 | ||||||
|         build-args: OCCLUM_VERSION=${{ env.OCCLUM_VERSION }} |         build-args: | | ||||||
|  |           "OCCLUM_VERSION=${{ env.OCCLUM_VERSION }}" | ||||||
|  |           "OCCLUM_BRANCH=${{ env.OCCLUM_BRANCH }}" | ||||||
|         push: true |         push: true | ||||||
|         tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-python |         tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-python | ||||||
| 
 | 
 | ||||||
| @ -212,6 +236,8 @@ jobs: | |||||||
| 
 | 
 | ||||||
|     - name: Set up Docker Buildx |     - name: Set up Docker Buildx | ||||||
|       uses: docker/setup-buildx-action@v1 |       uses: docker/setup-buildx-action@v1 | ||||||
|  |       with: | ||||||
|  |           driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=104857600 | ||||||
| 
 | 
 | ||||||
|     - name: Login to DockerHub |     - name: Login to DockerHub | ||||||
|       uses: docker/login-action@v1 |       uses: docker/login-action@v1 | ||||||
|  | |||||||
| @ -2,9 +2,10 @@ ARG OCCLUM_VERSION | |||||||
| FROM occlum/occlum:$OCCLUM_VERSION-ubuntu18.04 as base | FROM occlum/occlum:$OCCLUM_VERSION-ubuntu18.04 as base | ||||||
| LABEL maintainer="Chunyang Hui <sanqian.hcy@antgroup.com>" | LABEL maintainer="Chunyang Hui <sanqian.hcy@antgroup.com>" | ||||||
| 
 | 
 | ||||||
|  | ARG OCCLUM_BRANCH | ||||||
| WORKDIR /root | WORKDIR /root | ||||||
| RUN rm -rf /root/demos && \ | 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 && \ |     cp -r occlum/demos /root/demos && \ | ||||||
|     rm -rf /root/occlum |     rm -rf /root/occlum | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -4,7 +4,6 @@ FROM python:3.7-alpine3.10 as alpine | |||||||
| RUN apk add g++ lapack-dev gfortran && \ | RUN apk add g++ lapack-dev gfortran && \ | ||||||
|     pip3 install numpy pandas scipy==1.3.1 Cython scikit-learn==0.21.1 |     pip3 install numpy pandas scipy==1.3.1 Cython scikit-learn==0.21.1 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| FROM occlum/occlum:$OCCLUM_VERSION-ubuntu18.04 as base | FROM occlum/occlum:$OCCLUM_VERSION-ubuntu18.04 as base | ||||||
| LABEL maintainer="Chunyang Hui <sanqian.hcy@antgroup.com>" | LABEL maintainer="Chunyang Hui <sanqian.hcy@antgroup.com>" | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user