onnxruntime/dockerfiles/Dockerfile.openvino-csharp
sfatimar cccbe90764
Openvino ep 2022.2 v4.2 (#13023)
This changes are to align OV 2022.2 Release with ORT . Changes
CPU FP16 Support, dGPU Support, RHEL Dockerfile, Ubuntu 20 Dockerfile 

**Motivation and Context**
- This change is required to ensure ORT-OpenVINO Execution Provider is
aligned with latest changes.
- If it fixes an open issue, please link to the issue here.

Co-authored-by: mayavijx <mayax.vijayan@intel.com>
Co-authored-by: shamaksx <shamax.kshirsagar@intel.com>
Co-authored-by: pratiksha <pratikshax.bapusaheb.vanse@intel.com>
Co-authored-by: pratiksha <mohsinx.mohammad@intel.com>
Co-authored-by: Sahar Fatima <sfatima.3001@gmail.com>
Co-authored-by: Preetha Veeramalai <preetha.veeramalai@intel.com>
Co-authored-by: nmaajidk <n.maajid.khan@intel.com>
Co-authored-by: Mateusz Tabaka <mateusz.tabaka@intel.com>
Co-authored-by: intel <intel@iotgecsp-nuc04.iind.intel.com>
2022-09-22 12:31:40 -07:00

91 lines
3.3 KiB
Text

#-------------------------------------------------------------------------
# Copyright(C) 2021 Intel Corporation.
# SPDX-License-Identifier: MIT
#--------------------------------------------------------------------------
ARG OPENVINO_VERSION=2022.2.0
# Build stage
FROM openvino/ubuntu20_runtime:${OPENVINO_VERSION} AS base
ENV WORKDIR_PATH=/home/openvino
WORKDIR $WORKDIR_PATH
ENV DEBIAN_FRONTEND noninteractive
USER root
RUN apt update; apt install -y --no-install-recommends wget gnupg && \
rm -rf /var/lib/apt/lists/*
# Install Mono
RUN wget http://download.mono-project.com/repo/xamarin.gpg && apt-key add xamarin.gpg && rm xamarin.gpg && \
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | tee /etc/apt/sources.list.d/mono-official-stable.list && \
apt update -y && \
apt install -y mono-devel
# Install nuget.exe
RUN wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe && \
mv nuget.exe /usr/local/bin/nuget.exe && \
echo 'mono /usr/local/bin/nuget.exe $@' > /usr/local/bin/nuget && \
chmod a+x /usr/local/bin/nuget
# Install .NET core
RUN wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
apt-get update -y &&\
apt-get install -y apt-transport-https && \
apt-get update -y && \
apt-get install -y dotnet-sdk-5.0
# Build stage
FROM base AS builder
ENV WORKDIR_PATH=/home/openvino
WORKDIR $WORKDIR_PATH
ENV DEBIAN_FRONTEND noninteractive
ARG DEVICE=CPU_FP32
ARG ONNXRUNTIME_REPO=https://github.com/microsoft/onnxruntime.git
ARG ONNXRUNTIME_BRANCH=main
ENV InferenceEngine_DIR=${INTEL_OPENVINO_DIR}/runtime/cmake
ENV LANG en_US.UTF-8
USER root
RUN apt update; apt install -y --no-install-recommends git protobuf-compiler libprotobuf-dev ca-certificates unattended-upgrades && \
unattended-upgrade && \
rm -rf /var/lib/apt/lists/*
RUN git clone --recursive -b ${ONNXRUNTIME_BRANCH} ${ONNXRUNTIME_REPO}
RUN /bin/sh onnxruntime/dockerfiles/scripts/install_common_deps.sh
RUN ln -s cmake-* cmake-dir
RUN python3 -m pip install wheel
ENV PATH=${WORKDIR_PATH}/cmake-dir/bin:$PATH
RUN pip3 install onnx
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN apt install locales && \
locale-gen en_US en_US.UTF-8 && \
dpkg-reconfigure locales
RUN cd onnxruntime && ./build.sh --config Release --update --build --parallel --use_openvino ${DEVICE} --build_nuget --build_shared_lib
RUN cp /home/openvino/onnxruntime/build/Linux/Release/Microsoft.ML.OnnxRuntime.Managed* /home/openvino/onnxruntime/build/Linux/Release/nuget-artifacts
# Deploy stage
FROM base
ENV DEBIAN_FRONTEND noninteractive
USER root
RUN apt update; apt install -y unattended-upgrades fonts-freefont-ttf && \
unattended-upgrade
ARG BUILD_UID=1001
ARG BUILD_USER=onnxruntimedev
RUN adduser --uid $BUILD_UID $BUILD_USER
RUN usermod -a -G video,users ${BUILD_USER}
ENV WORKDIR_PATH /home/${BUILD_USER}
WORKDIR ${WORKDIR_PATH}
COPY --from=builder /home/openvino/onnxruntime/build/Linux/Release/nuget-artifacts ${WORKDIR_PATH}/nuget-artifacts
USER ${BUILD_USER}
ENV PATH=${WORKDIR_PATH}/miniconda/bin:${WORKDIR_PATH}/cmake-dir/bin:$PATH
ENV IE_PLUGINS_PATH=${INTEL_OPENVINO_DIR}/runtime/lib/intel64
ENV LD_LIBRARY_PATH=/opt/intel/opencl:${INTEL_OPENVINO_DIR}/runtime/3rdparty/tbb/lib:${IE_PLUGINS_PATH}:${LD_LIBRARY_PATH}