ARG OCCLUM_VERSION FROM tensorflow/serving:latest-devel as binary_build WORKDIR /tensorflow-serving # Build, and install TensorFlow Serving ARG TF_SERVING_BUILD_OPTIONS="--config=nativeopt" RUN echo "Building with build options: ${TF_SERVING_BUILD_OPTIONS}" ARG TF_SERVING_BAZEL_OPTIONS="" RUN echo "Building with Bazel options: ${TF_SERVING_BAZEL_OPTIONS}" RUN bazel build -j 8 --color=yes --curses=yes \ ${TF_SERVING_BAZEL_OPTIONS} \ --verbose_failures \ --force_pic \ --output_filter=DONT_MATCH_ANYTHING \ ${TF_SERVING_BUILD_OPTIONS} \ tensorflow_serving/model_servers:tensorflow_model_server && \ cp bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server \ /usr/local/bin/ # Build and install TensorFlow Serving API RUN bazel build -j 8 --color=yes --curses=yes \ ${TF_SERVING_BAZEL_OPTIONS} \ --force_pic \ --verbose_failures \ --output_filter=DONT_MATCH_ANYTHING \ ${TF_SERVING_BUILD_OPTIONS} \ tensorflow_serving/tools/pip_package:build_pip_package && \ bazel-bin/tensorflow_serving/tools/pip_package/build_pip_package \ /tmp/pip && \ pip --no-cache-dir install --upgrade \ /tmp/pip/tensorflow_serving_api-*.whl && \ rm -rf /tmp/pip FROM occlum/occlum:$OCCLUM_VERSION-ubuntu18.04 as base LABEL maintainer="Zehuan Li " 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