diff --git a/.github/workflows/build_and_push_ci_image.yml b/.github/workflows/build_and_push_ci_image.yml index 4f28ba5f..7944b2c1 100644 --- a/.github/workflows/build_and_push_ci_image.yml +++ b/.github/workflows/build_and_push_ci_image.yml @@ -209,6 +209,10 @@ jobs: tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-python + # TODO: Add actions to build tf_serving_base image. + # Building TF serving demo image needs a lot of time which exceeds the maximum time limit for a jong of GitHub Actions. + # Thus dividing into two jobs. + Build_tf_serving_image: runs-on: ubuntu-18.04 if: github.event.inputs.image_name == 'tf_serving' @@ -244,12 +248,12 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - + - name: Build and push uses: docker/build-push-action@v2 with: context: . - file: ./tools/docker/ci/Dockerfile.tf_serving + file: ./tools/docker/ci/Dockerfile.tf_serving_occlum platforms: linux/amd64 build-args: | "OCCLUM_VERSION=${{ env.OCCLUM_VERSION }}" diff --git a/demos/openvino/download_and_build_openvino.sh b/demos/openvino/download_and_build_openvino.sh index edf395f1..1dac1794 100755 --- a/demos/openvino/download_and_build_openvino.sh +++ b/demos/openvino/download_and_build_openvino.sh @@ -28,7 +28,7 @@ build_opencv() { -DBUILD_opencv_python=OFF -DBUILD_PYTHON_SUPPORT=OFF \ -DBUILD_EXAMPLES=OFF -DWITH_FFMPEG=OFF \ -DWITH_QT=OFF -DWITH_CUDA=OFF - make -j + make -j4 sudo make install popd } diff --git a/tools/docker/ci/Dockerfile.tf_serving b/tools/docker/ci/Dockerfile.tf_serving_base similarity index 70% rename from tools/docker/ci/Dockerfile.tf_serving rename to tools/docker/ci/Dockerfile.tf_serving_base index 925fbd3e..81b59434 100644 --- a/tools/docker/ci/Dockerfile.tf_serving +++ b/tools/docker/ci/Dockerfile.tf_serving_base @@ -1,6 +1,5 @@ -ARG OCCLUM_VERSION - FROM tensorflow/serving:latest-devel as binary_build +LABEL maintainer="Zehuan Li " WORKDIR /tensorflow-serving # Build, and install TensorFlow Serving ARG TF_SERVING_BUILD_OPTIONS="--config=nativeopt" @@ -32,22 +31,6 @@ RUN bazel build -j 8 --color=yes --curses=yes \ /tmp/pip/tensorflow_serving_api-*.whl && \ rm -rf /tmp/pip -FROM occlum/occlum:$OCCLUM_VERSION-ubuntu18.04 as base -LABEL maintainer="Zehuan Li " +RUN cp -r /usr/local/bin/tensorflow_model_server /root/tensorflow_model_server WORKDIR /root -COPY --from=binary_build /usr/local/bin/tensorflow_model_server /root/tensorflow_model_server - -ARG OCCLUM_BRANCH -RUN apt-get update && apt-get install git && \ - git clone -b $OCCLUM_BRANCH git://github.com/occlum/occlum.git && \ - cd occlum && \ - cd demos/tensorflow/tensorflow_serving && \ - ./prepare_model_and_env.sh && \ - cd client && \ - ./prepare_client_env.sh && \ - mv ../resnet50-v15-fp32/ /root && \ - rm -rf /root/occlum - -WORKDIR /root - diff --git a/tools/docker/ci/Dockerfile.tf_serving_occlum b/tools/docker/ci/Dockerfile.tf_serving_occlum new file mode 100644 index 00000000..4f520755 --- /dev/null +++ b/tools/docker/ci/Dockerfile.tf_serving_occlum @@ -0,0 +1,22 @@ +ARG OCCLUM_VERSION +FROM occlumbackup/occlum:latest-ubuntu18.04-tf_serving_base as binary_build +WORKDIR /root + +FROM occlum/occlum:$OCCLUM_VERSION-ubuntu18.04 as base +LABEL maintainer="Chunyang Hui " + +WORKDIR /root +COPY --from=binary_build /root/tensorflow_model_server /root/tensorflow_model_server + +ARG OCCLUM_BRANCH +RUN apt-get update && apt-get install git && \ + git clone -b $OCCLUM_BRANCH git://github.com/occlum/occlum.git && \ + cd occlum && \ + cd demos/tensorflow/tensorflow_serving && \ + ./prepare_model_and_env.sh && \ + cd client && \ + ./prepare_client_env.sh && \ + mv ../resnet50-v15-fp32/ /root && \ + rm -rf /root/occlum + +WORKDIR /root