microsoft/onnxruntime-extensions

Public

mirrored from https://github.com/microsoft/onnxruntime-extensionsAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
rel-0.4

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

docker/onnx_ort_ext/Dockerfile

71lines · modecode

1# This Dockerfile will build Docker Image with
2# ONNX (from ONNXRuntime submodule) + ONNXRuntime + ONNXRuntime-Extensions
3# installed for CPU only
4#
5# Example commandline to build this full package set.
6# docker build . -t docker-image-repo-name
7# Example commandline to run the built docker container:
8# sudo docker run --name container-name -it docker-image-repo-name
9
10ARG PYTHON_VERSION=3.8
11
12FROM ubuntu:18.04
13
14RUN apt-get update && apt-get install -y --no-install-recommends \
15 apt-utils \
16 build-essential \
17 ca-certificates \
18 ccache \
19 cmake \
20 curl \
21 git \
22 wget \
23 gcc-8 \
24 g++-8 \
25 libprotobuf-dev \
26 protobuf-compiler && \
27 rm -rf /var/lib/apt/lists/*
28RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 100 && \
29 update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 100
30RUN /usr/sbin/update-ccache-symlinks
31RUN mkdir /opt/ccache && ccache --set-config=cache_dir=/opt/ccache
32
33ENV PATH /opt/conda/bin:$PATH
34
35RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
36 chmod +x ~/miniconda.sh && \
37 ~/miniconda.sh -b -p /opt/conda && \
38 rm ~/miniconda.sh && \
39 /opt/conda/bin/conda install -y python=${PYTHON_VERSION} conda-build && \
40 /opt/conda/bin/conda install -y numpy ninja setuptools cmake protobuf typing-extensions && \
41 /opt/conda/bin/conda clean -ya
42
43ADD . /source
44WORKDIR /root
45RUN if [ -d /source/onnnxruntime ] ; then ln -s /source/onnxruntime /root/onnxruntime ; fi
46RUN if [ ! -L /root/onnxruntime ] ; then git clone https://github.com/microsoft/onnxruntime.git && \
47 cd onnxruntime && git submodule update --init --recursive ; fi
48
49RUN cd /root/onnxruntime/cmake/external/onnx && \
50 CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=ON" python3 setup.py bdist_wheel && \
51 python3 -m pip install dist/*.whl
52
53RUN cd /root/onnxruntime && \
54 /bin/bash ./build.sh \
55 --config Release \
56 --build_wheel \
57 --update \
58 --build \
59 --parallel \
60 --skip_submodule_sync \
61 --cmake_extra_defines \
62 ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) && \
63 python3 -m pip install /root/onnxruntime/build/Linux/Release/dist/*.whl
64
65RUN cd /root/onnxruntime/cmake/external/onnxruntime-extensions && \
66 python3 setup.py bdist_wheel && \
67 python3 -m pip install dist/*.whl
68
69RUN if [ -L /root/onnxruntime ]; then unlink /root/onnxruntime ; fi && \
70 if [ -d /root/onnxruntime ]; then rm -rf /root/onnxruntime ; fi && \
71 rm -rf /opt/ccache
72