Adding the onnxruntime Dockerfile and instructions (#968)

* Adding the onnxruntime Dockerfile and instructions

* Adding the onnxruntime server Dockerfile with build and instructions

* Specify more details in instruction

* Update dockerfiles/README.md

Co-Authored-By: tianchijushi <huaimingyang@hotmail.com>

* Update Dockerfile.server

Specify the onnxruntime server build branch during git clone
This commit is contained in:
Harry Yang 2019-05-08 18:24:16 -07:00 committed by Pranav Sharma
parent 9a4128efac
commit 2512b0ebeb
2 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,35 @@
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#--------------------------------------------------------------------------
# Official user quickstart docker container for ONNX Runtime CPU
# Ubuntu 16.04, CPU version, Python 3.
#--------------------------------------------------------------------------
FROM ubuntu:16.04 AS minimal
MAINTAINER Harry Yang "huayang@microsoft.com"
FROM ubuntu:16.04 AS build
ARG PYTHON_VERSION=3.5
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 https://github.com/Microsoft/onnxruntime 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
WORKDIR /
RUN mkdir -p /onnxruntime/build && \
python3 /onnxruntime/tools/ci_build/build.py --build_dir /onnxruntime/build --config Release --build_server
FROM minimal AS final
WORKDIR /onnxruntime/server/
ENV MODEL_ABSOLUTE_PATH /onnxruntime/model/model.onnx
COPY --from=build /onnxruntime/build/Release/onnxruntime_server /onnxruntime/server/
RUN apt-get update \
&& apt-get install -y libgomp1
ENTRYPOINT /onnxruntime/server/onnxruntime_server --model_path $MODEL_ABSOLUTE_PATH

View file

@ -17,3 +17,22 @@
docker run -it onnxruntime-ngraph
```
## ONNX Runtime Server (Preview)
#### Linux 16.04
1. Build the docker image from the Dockerfile in this repository
```
docker build -t {docker_image_name} -f Dockerfile.server .
```
2. Run the ONNXRuntime server with the image created in step 1
```
docker run -v {localModelAbsoluteFolder}:{dockerModelAbsoluteFolder} -e MODEL_ABSOLUTE_PATH={dockerModelAbsolutePath} -p {your_local_port}:8001 {imageName}
```
3. Send HTTP requests to the container running ONNX Runtime Server
Send HTTP requests to the docker container through the binding local port. Here is the full [usage document](https://github.com/Microsoft/onnxruntime/blob/master/docs/ONNX_Runtime_Server_Usage.md).
```
curl -X POST -d "@request.json" -H "Content-Type: application/json" http://0.0.0.0:{your_local_port}/v1/models/mymodel/versions/3:predict