Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions dockerfiles/Dockerfile.cuda
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# --------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------
# Dockerfile to run ONNXRuntime with CUDA, CUDNN integration

# nVidia cuda 10.0 Base Image
FROM nvidia/cuda:10.0-cudnn7-devel
MAINTAINER Vinitra Swamy "viswamy@microsoft.com"

ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_SERVER_BRANCH=master

RUN apt-get update &&\
apt-get install -y sudo git bash

WORKDIR /code
ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:/code/cmake-3.14.3-Linux-x86_64/bin:/opt/miniconda/bin:${PATH}

# Prepare onnxruntime repository & build onnxruntime with TensorRT
RUN git clone --single-branch --branch ${ONNXRUNTIME_SERVER_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime &&\
/bin/sh onnxruntime/dockerfiles/install_common_deps.sh &&\
cp onnxruntime/dockerfiles/LICENSE-IMAGE.txt /code/LICENSE-IMAGE.txt &&\
cd onnxruntime &&\
/bin/sh ./build.sh --cuda_home /usr/local/cuda --cudnn_home /usr/lib/x86_64-linux-gnu/ --use_cuda --config Release --build_wheel --update --build --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) &&\
pip install /code/onnxruntime/build/Linux/Release/dist/*.whl &&\
cd .. &&\
rm -rf onnxruntime cmake-3.14.3-Linux-x86_64.tar.gz cmake-3.14.3-Linux-x86_64
27 changes: 27 additions & 0 deletions dockerfiles/Dockerfile.source
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# --------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------
# Dockerfile to run ONNXRuntime with source build for CPU

# Ubuntu 16.04 Base Image
FROM ubuntu:16.04
MAINTAINER Vinitra Swamy "viswamy@microsoft.com"

ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_SERVER_BRANCH=master

RUN apt-get update &&\
apt-get install -y sudo git bash

WORKDIR /code
ENV PATH /opt/miniconda/bin:/code/cmake-3.14.3-Linux-x86_64/bin:${PATH}

# Prepare onnxruntime repository & build onnxruntime
RUN git clone --single-branch --branch ${ONNXRUNTIME_SERVER_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime &&\
/bin/sh onnxruntime/dockerfiles/install_common_deps.sh &&\
cd onnxruntime &&\
/bin/sh ./build.sh --config Release --build_wheel --update --build --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) &&\
pip install /code/onnxruntime/build/Linux/Release/dist/*.whl &&\
cd .. &&\
rm -rf onnxruntime cmake-3.14.3-Linux-x86_64.tar.gz cmake-3.14.3-Linux-x86_64
28 changes: 28 additions & 0 deletions dockerfiles/Dockerfile.tensorrt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# --------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------
# Dockerfile to run ONNXRuntime with TensorRT integration

# nVidia TensorRT Base Image
FROM nvcr.io/nvidia/tensorrt:19.02-py3
MAINTAINER Vinitra Swamy "viswamy@microsoft.com"

ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_SERVER_BRANCH=master

RUN apt-get update &&\
apt-get install -y sudo git bash

WORKDIR /code
ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:/code/cmake-3.14.3-Linux-x86_64/bin:/opt/miniconda/bin:${PATH}

# Prepare onnxruntime repository & build onnxruntime with TensorRT
RUN git clone --single-branch --branch ${ONNXRUNTIME_SERVER_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime &&\
/bin/sh onnxruntime/dockerfiles/install_common_deps.sh &&\
cp onnxruntime/dockerfiles/LICENSE-IMAGE.txt /code/LICENSE-IMAGE.txt &&\
cd onnxruntime &&\
/bin/sh ./build.sh --cuda_home /usr/local/cuda --cudnn_home /usr/lib/x86_64-linux-gnu/ --use_tensorrt --tensorrt_home /workspace/tensorrt --config Release --build_wheel --update --build --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) &&\
pip install /code/onnxruntime/build/Linux/Release/dist/*.whl &&\
cd .. &&\
rm -rf onnxruntime cmake-3.14.3-Linux-x86_64.tar.gz cmake-3.14.3-Linux-x86_64
15 changes: 15 additions & 0 deletions dockerfiles/LICENSE-IMAGE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
This image is made available to you on the condition that you agree to
[your agreement][1] governing your use of Azure.
If you do not have an existing agreement governing your use of Azure, you agree that
your agreement governing use of Azure is the [Microsoft Online Subscription Agreement][2]
(which incorporates the [Online Services Terms][3]).
By using the software you agree to these terms. This software may collect data
that is transmitted to Microsoft. Please see the [Microsoft Privacy Statement][4]
to learn more about how Microsoft processes personal data.

This image must be used on Microsoft Azure Services only.

[1]: https://azure.microsoft.com/en-us/support/legal/
[2]: https://azure.microsoft.com/en-us/support/legal/subscription-agreement/
[3]: http://www.microsoftvolumelicensing.com/DocumentSearch.aspx?Mode=3&DocumentTypeId=46
[4]: http://go.microsoft.com/fwlink/?LinkId=248681
89 changes: 75 additions & 14 deletions dockerfiles/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,48 @@
# Quick-start Docker containers for ONNX Runtime
# Docker containers for ONNX Runtime

- [Arm 32v7](Dockerfile.arm32v7)
- [Build from source (CPU)](Dockerfile.source)
- [CUDA + CUDNN](Dockerfile.cuda)
- [nGraph](Dockerfile.ngraph)
- [TensorRT](Dockerfile.tensorrt)
- [OpenVINO](Dockerfile.openvino)
- [ONNX Runtime Server](Dockerfile.server)

## Build from Source Version (Preview)
#### Linux 16.04, CPU, Python Bindings

1. Build the docker image from the Dockerfile in this repository.
```
# If you have a Linux machine, preface this command with "sudo"

docker build -t onnxruntime-source -f Dockerfile.source .
```

2. Run the Docker image

```
# If you have a Linux machine, preface this command with "sudo"

docker run -it onnxruntime-source
```

## CUDA Version (Preview)
#### Linux 16.04, CUDA 10.0, CuDNN 7

1. Build the docker image from the Dockerfile in this repository.
```
# If you have a Linux machine, preface this command with "sudo"

docker build -t onnxruntime-cuda -f Dockerfile.cuda .
```

2. Run the Docker image

```
# If you have a Linux machine, preface this command with "sudo"

docker run -it onnxruntime-cuda
```

## nGraph Version (Preview)
#### Linux 16.04, Python Bindings
Expand All @@ -18,24 +62,22 @@
docker run -it onnxruntime-ngraph
```

## ONNX Runtime Server (Preview)
#### Linux 16.04
## TensorRT Version (Preview)
#### Linux 16.04, TensorRT 5.0.2

1. Build the docker image from the Dockerfile in this repository
```
docker build -t {docker_image_name} -f Dockerfile.server .
1. Build the docker image from the Dockerfile in this repository.
```

2. Run the ONNXRuntime server with the image created in step 1
# If you have a Linux machine, preface this command with "sudo"

docker build -t onnxruntime-trt -f Dockerfile.tensorrt .
```
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).
2. Run the Docker image

```
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
# If you have a Linux machine, preface this command with "sudo"

docker run -it onnxruntime-trt
```

## OpenVINO Version (Preview)
Expand All @@ -58,4 +100,23 @@
# If you have a Linux machine, preface this command with "sudo"

docker run -it onnxruntime-openvino
```
```
## 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
```
25 changes: 25 additions & 0 deletions dockerfiles/install_common_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
DEBIAN_FRONTEND=noninteractive
apt-get install -y --no-install-recommends \
wget \
zip \
ca-certificates \
build-essential \
curl \
libcurl4-openssl-dev \
libssl-dev \
python3-dev

# Dependencies: conda
wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh -O ~/miniconda.sh --no-check-certificate && /bin/bash ~/miniconda.sh -b -p /opt/miniconda
rm ~/miniconda.sh
/opt/miniconda/bin/conda clean -tipsy
find / -type d -name __pycache__ -prune -exec rm -rf {};

conda install -y python=3.6 numpy
conda clean -aqy
rm -rf /opt/miniconda/pkgs

# Dependencies: cmake
sudo wget --quiet https://github.com/Kitware/CMake/releases/download/v3.14.3/cmake-3.14.3-Linux-x86_64.tar.gz
Comment thread
vinitra-zz marked this conversation as resolved.
tar zxf cmake-3.14.3-Linux-x86_64.tar.gz