Skip to content

Commit

Permalink
add docker file to build onnxruntime with different execution providers
Browse files Browse the repository at this point in the history
  • Loading branch information
zhijxu-MS authored and snnn committed Oct 28, 2019
1 parent 3926ce3 commit 0b88eff
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 0 deletions.
40 changes: 40 additions & 0 deletions dockerfiles/Dockerfile.server.mkldnn
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#-------------------------------------------------------------------------
# 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_mkldnn --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/mkl-dnn/install/lib/libmkldnn.so* /lib/
RUN apt-get update && apt-get install -y libgomp1
ENTRYPOINT ["/onnxruntime/server/onnxruntime_server"]

42 changes: 42 additions & 0 deletions dockerfiles/Dockerfile.server.mkldnn_mklml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#-------------------------------------------------------------------------
# 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_mkldnn --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/mkl-dnn/install/lib/libmkldnn.so* /lib/
COPY --from=build /onnxruntime/build/Release/mklml/src/project_mklml/lib/*.so* /lib/
ENTRYPOINT ["/onnxruntime/server/onnxruntime_server"]

39 changes: 39 additions & 0 deletions dockerfiles/Dockerfile.server.ngraph
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#-------------------------------------------------------------------------
# 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"]
41 changes: 41 additions & 0 deletions dockerfiles/Dockerfile.server.nuphar
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#-------------------------------------------------------------------------
# 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/zhijxu-MS/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"]

0 comments on commit 0b88eff

Please sign in to comment.