Fix onnxruntime server docker file build failure (#3219)

1. Fix onnxruntime server docker file build failure. Tested with the notebook in ONNX tutorial, it works well.
2. Delete the docker files for the other EPs, because currently they don't work and I don't have enough time to update them.
This commit is contained in:
Changming Sun 2020-03-15 14:46:46 -07:00 committed by GitHub
parent 88c20eaef1
commit 0fceb33288
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 242 deletions

View file

@ -20,20 +20,19 @@ RUN apt-get update && \
ENV PATH="/opt/cmake/bin:${PATH}"
RUN git clone --single-branch --branch ${ONNXRUNTIME_SERVER_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime
RUN /onnxruntime/tools/ci_build/github/linux/docker/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} && \
/onnxruntime/tools/ci_build/github/linux/docker/scripts/install_deps.sh -p ${PYTHON_VERSION} && \
/onnxruntime/tools/ci_build/github/linux/docker/scripts/install_server_deps.sh
RUN /onnxruntime/tools/ci_build/github/linux/docker/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} \
&& /onnxruntime/tools/ci_build/github/linux/docker/scripts/install_server_deps.sh
ENV PATH="/usr/local/go/bin:${PATH}"
WORKDIR /
RUN mkdir -p /onnxruntime/build && \
python3 /onnxruntime/tools/ci_build/build.py --build_dir /onnxruntime/build --config Release --build_server --parallel --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER)
RUN mkdir -p /onnxruntime/build && cd /onnxruntime/build && cmake -DCMAKE_BUILD_TYPE=Release /onnxruntime/server \
&& make -j$(getconf _NPROCESSORS_ONLN)
FROM minimal AS final
COPY --from=build /onnxruntime/build/onnxruntime_server /onnxruntime/server/
COPY --from=build /usr/lib/libonnxruntime.so.1.2.0 /usr/local/lib/libcares.so.2.3.0 /usr/lib/
RUN ln -s /usr/lib/libonnxruntime.so.1.2.0 /usr/lib/libonnxruntime.so && ln -s /usr/local/lib/libcares.so.2.3.0 /usr/local/lib/libcares.so.2 && ln -s /usr/local/lib/libcares.so.2 /usr/local/lib/libcares.so && ldconfig /usr/local/lib && apt-get update \
&& apt-get install -y libgomp1 libre2-1v5 libssl1.0.0
WORKDIR /onnxruntime/server/
COPY --from=build /onnxruntime/build/Release/onnxruntime_server /onnxruntime/server/
COPY --from=build /onnxruntime/build/Release/libonnxruntime.so.* /lib/
RUN apt-get update \
&& apt-get install -y libgomp1
ENTRYPOINT ["/onnxruntime/server/onnxruntime_server"]

View file

@ -1,40 +0,0 @@
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#--------------------------------------------------------------------------
# Official docker container for ONNX Runtime Server
# Ubuntu 16.04, CPU version, Python 3.
#--------------------------------------------------------------------------
FROM ubuntu:16.04 AS build
ARG PYTHON_VERSION=3.5
ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_SERVER_BRANCH=master
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install -y sudo git bash
ENV PATH="/opt/cmake/bin:${PATH}"
RUN git clone --single-branch --branch ${ONNXRUNTIME_SERVER_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime
RUN /onnxruntime/tools/ci_build/github/linux/docker/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} && \
/onnxruntime/tools/ci_build/github/linux/docker/scripts/install_deps.sh -p ${PYTHON_VERSION} && \
/onnxruntime/tools/ci_build/github/linux/docker/scripts/install_server_deps.sh
RUN /bin/sh /onnxruntime/dockerfiles/scripts/install_common_deps.sh
ENV PATH="/usr/local/go/bin:${PATH}"
WORKDIR /
RUN mkdir -p /onnxruntime/build
RUN python3 /onnxruntime/tools/ci_build/build.py --build_dir /onnxruntime/build --config Release --use_dnnl --build_server --parallel --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER)
FROM ubuntu:16.04 AS minimal
WORKDIR /onnxruntime/server/
COPY --from=build /onnxruntime/build/Release/onnxruntime_server /onnxruntime/server/
COPY --from=build /onnxruntime/build/Release/libonnxruntime.so.* /lib/
COPY --from=build /onnxruntime/build/Release/dnnl/install/lib/libdnnl.so* /lib/
RUN apt-get update && apt-get install -y libgomp1
ENTRYPOINT ["/onnxruntime/server/onnxruntime_server"]

View file

@ -1,42 +0,0 @@
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#--------------------------------------------------------------------------
# Official docker container for ONNX Runtime Server
# Ubuntu 16.04, CPU version, Python 3.
#--------------------------------------------------------------------------
FROM ubuntu:16.04 AS build
ARG PYTHON_VERSION=3.5
ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_SERVER_BRANCH=master
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install -y sudo git bash
ENV PATH="/opt/cmake/bin:${PATH}"
RUN git clone --single-branch --branch ${ONNXRUNTIME_SERVER_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime
RUN /onnxruntime/tools/ci_build/github/linux/docker/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} && \
/onnxruntime/tools/ci_build/github/linux/docker/scripts/install_deps.sh -p ${PYTHON_VERSION} && \
/onnxruntime/tools/ci_build/github/linux/docker/scripts/install_server_deps.sh
RUN /bin/sh /onnxruntime/dockerfiles/scripts/install_common_deps.sh
ENV PATH="/usr/local/go/bin:${PATH}"
WORKDIR /
RUN mkdir -p /onnxruntime/build
RUN python3 /onnxruntime/tools/ci_build/build.py --build_dir /onnxruntime/build --config Release --use_dnnl --use_mklml \
--build_server --parallel --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER)
FROM ubuntu:16.04 AS minimal
WORKDIR /onnxruntime/server/
RUN apt-get update && apt-get install -y libgomp1
COPY --from=build /onnxruntime/build/Release/onnxruntime_server /onnxruntime/server/
COPY --from=build /onnxruntime/build/Release/libonnxruntime.so.* /lib/
COPY --from=build /onnxruntime/build/Release/dnnl/install/lib/libdnnl.so* /lib/
COPY --from=build /onnxruntime/build/Release/mklml/src/project_mklml/lib/*.so* /lib/
ENTRYPOINT ["/onnxruntime/server/onnxruntime_server"]

View file

@ -1,39 +0,0 @@
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#--------------------------------------------------------------------------
# Official docker container for ONNX Runtime Server
# Ubuntu 16.04, CPU version, Python 3.
#--------------------------------------------------------------------------
FROM ubuntu:16.04 AS minimal
FROM ubuntu:16.04 AS build
ARG PYTHON_VERSION=3.5
ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_SERVER_BRANCH=master
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install -y sudo git bash
ENV PATH="/opt/cmake/bin:${PATH}"
RUN git clone --single-branch --branch ${ONNXRUNTIME_SERVER_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime
RUN /onnxruntime/tools/ci_build/github/linux/docker/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} && \
/onnxruntime/tools/ci_build/github/linux/docker/scripts/install_deps.sh -p ${PYTHON_VERSION} && \
/onnxruntime/tools/ci_build/github/linux/docker/scripts/install_server_deps.sh
ENV PATH="/usr/local/go/bin:${PATH}"
WORKDIR /
RUN mkdir -p /onnxruntime/build && \
python3 /onnxruntime/tools/ci_build/build.py --build_dir /onnxruntime/build --config Release --use_ngraph --build_server --parallel --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER)
FROM minimal AS final
WORKDIR /onnxruntime/server/
COPY --from=build /onnxruntime/build/Release/onnxruntime_server /onnxruntime/server/
COPY --from=build /onnxruntime/build/Release/libonnxruntime.so.* /lib/
COPY --from=build /onnxruntime/build/Release/external/ngraph/lib/*.so* /lib/
RUN apt-get update \
&& apt-get install -y libgomp1
ENTRYPOINT ["/onnxruntime/server/onnxruntime_server"]

View file

@ -1,41 +0,0 @@
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#--------------------------------------------------------------------------
FROM ubuntu:16.04 as build
ARG PYTHON_VERSION=3.5
ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_SERVER_BRANCH=master
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install -y sudo git bash
ENV PATH="/opt/cmake/bin:${PATH}"
RUN git clone --single-branch --branch ${ONNXRUNTIME_SERVER_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime
RUN /onnxruntime/tools/ci_build/github/linux/docker/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} && \
/onnxruntime/tools/ci_build/github/linux/docker/scripts/install_deps.sh -p ${PYTHON_VERSION} && \
/onnxruntime/tools/ci_build/github/linux/docker/scripts/install_server_deps.sh
ENV PATH="/usr/local/go/bin:${PATH}"
WORKDIR /
RUN mkdir -p /onnxruntime/build && \
pip3 install sympy packaging && \
python3 /onnxruntime/tools/ci_build/build.py --build_dir /onnxruntime/build --config Release --build_shared_lib --skip_submodule_sync \
--build_server \
--parallel --use_nuphar --use_mklml --use_tvm --use_llvm
FROM ubuntu:16.04 AS final
WORKDIR /onnxruntime/server/
COPY --from=build /onnxruntime/build/Release/onnxruntime_server /onnxruntime/server/
COPY --from=build /onnxruntime/build/Release/libonnxruntime.so.* /lib/
COPY --from=build /onnxruntime/build/Release/mklml/src/project_mklml/lib/*.so* /lib/
COPY --from=build /onnxruntime/build/Release/external/tvm/*.so* /lib/
ENTRYPOINT ["/onnxruntime/server/onnxruntime_server"]

View file

@ -1,69 +0,0 @@
#-------------------------------------------------------------------------
# Copyright(C) 2019 Intel Corporation.
# Licensed under the MIT License.
#--------------------------------------------------------------------------
FROM ubuntu:16.04
RUN apt update && \
apt -y install git sudo wget bash \
python3.5 python3-pip zip x11-apps lsb-core cpio libboost-python-dev libpng-dev zlib1g-dev libnuma1 ocl-icd-libopencl1 clinfo libboost-filesystem1.58.0 libboost-thread1.58.0 protobuf-compiler libprotoc-dev libusb-1.0-0-dev
ARG PYTHON_VERSION=3.5
ARG DEVICE=CPU_FP32
ARG ONNXRUNTIME_REPO=https://github.com/microsoft/onnxruntime
ARG ONNXRUNTIME_SERVER_BRANCH=master
RUN git clone --single-branch --branch ${ONNXRUNTIME_SERVER_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime
RUN /onnxruntime/tools/ci_build/github/linux/docker/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} && \
/onnxruntime/tools/ci_build/github/linux/docker/scripts/install_deps.sh -p ${PYTHON_VERSION} && \
/onnxruntime/tools/ci_build/github/linux/docker/scripts/install_server_deps.sh
RUN /bin/sh /onnxruntime/dockerfiles/scripts/install_common_deps.sh
ENV PATH="/usr/local/go/bin:${PATH}"
ENV pattern="COMPONENTS=DEFAULTS"
ENV replacement="COMPONENTS=intel-openvino-ie-sdk-ubuntu-xenial__x86_64;intel-openvino-ie-rt-cpu-ubuntu-xenial__x86_64;intel-openvino-ie-rt-gpu-ubuntu-xenial__x86_64;intel-openvino-ie-rt-vpu-ubuntu-xenial__x86_64;intel-openvino-ie-rt-hddl-ubuntu-xenial__x86_64;intel-openvino-model-optimizer__x86_64;intel-openvino-opencv-lib-ubuntu-xenial__x86_64"
COPY l_openvino_*.tgz .
RUN tar -xzf l_openvino_toolkit*.tgz && \
rm -rf l_openvino_toolkit*.tgz && \
cd l_openvino_toolkit* && \
sed -i "s/$pattern/$replacement/" silent.cfg && \
sed -i 's/decline/accept/g' silent.cfg && \
./install.sh -s silent.cfg && \
cd - && \
rm -rf l_openvino_toolkit* && \
cd /opt/intel/openvino/install_dependencies && ./_install_all_dependencies.sh && dpkg -i *.deb && \
pip3 install networkx==2.3 test-generator==0.1.1 defusedxml>=0.5.0
ENV LD_LIBRARY_PATH=/usr/lib:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
ENV INTEL_OPENVINO_DIR=/opt/intel/openvino_2019.3.376
ENV INTEL_CVSDK_DIR=/opt/intel/openvino_2019.3.376
ENV InferenceEngine_DIR=${INTEL_CVSDK_DIR}/deployment_tools/inference_engine/share
ENV IE_PLUGINS_PATH=${INTEL_CVSDK_DIR}/deployment_tools/inference_engine/lib/intel64
ENV LD_LIBRARY_PATH=/opt/intel/opencl:${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/cldnn/lib:${INTEL_OPENVINO_DIR}/inference_engine/external/gna/lib:${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/mkltiny_lnx/lib:${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/omp/lib:${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/tbb/lib:${IE_PLUGINS_PATH}:${LD_LIBRARY_PATH}
ENV OpenCV_DIR=${INTEL_OPENVINO_DIR}/opencv/share/OpenCV
ENV LD_LIBRARY_PATH=${INTEL_OPENVINO_DIR}/opencv/lib:${INTEL_OPENVINO_DIR}/opencv/share/OpenCV/3rdparty/lib:${LD_LIBRARY_PATH}
ENV PATH=${INTEL_CVSDK_DIR}/deployment_tools/model_optimizer:$PATH
ENV PYTHONPATH=${INTEL_CVSDK_DIR}/deployment_tools/model_optimizer:$PYTHONPATH
ENV HDDL_INSTALL_DIR=${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/hddl
ENV LD_LIBRARY_PATH=${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/hddl/lib:$LD_LIBRARY_PATH
RUN locale-gen en_US.UTF-8 && update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
RUN mkdir -p /opt/cmake/bin
ENV PATH /opt/cmake/bin:$PATH
RUN wget https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2-Linux-x86_64.tar.gz && \
tar -xf cmake-3.13.2-Linux-x86_64.tar.gz --strip 1 -C /opt/cmake && rm -rf /cmake-3.13.2-Linux-x86_64.tar.gz
WORKDIR /onnxruntime/build/Release/
RUN mkdir -p /onnxruntime/build
RUN rm -rf /usr/bin/python && ln -s /usr/bin/python3 /usr/bin/python && \
ln -s /usr/bin/pip3 /usr/bin/pip
RUN python3 /onnxruntime/tools/ci_build/build.py --build_dir /onnxruntime/build --config Release --use_openvino $DEVICE --build_server --parallel --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER)
ENTRYPOINT ["/onnxruntime/build/Release/onnxruntime_server"]

View file

@ -19,8 +19,8 @@ if [ $SYS_LONG_BIT = "64" ]; then
tar -zxf cmake-3.16.2-Linux-x86_64.tar.gz --strip=1 -C /usr
echo "Installing onnxruntime"
aria2c https://github.com/microsoft/onnxruntime/releases/download/v1.1.0/onnxruntime-linux-x64-1.1.0.tgz
tar -zxf onnxruntime-linux-x64-1.1.0.tgz --strip=1
aria2c https://github.com/microsoft/onnxruntime/releases/download/v1.2.0/onnxruntime-linux-x64-1.2.0.tgz
tar -zxf onnxruntime-linux-x64-1.2.0.tgz --strip=1
cp -r include/* /usr/include
cp -r lib/* /usr/lib
ldconfig /usr/lib