|
1 |
| -# This Dockerfile demonstrates how to build the openvino bindings using an installation of OpenVINO. For instructions |
2 |
| -# to install OpenVINO see the OpenVINO documentation, e.g. |
| 1 | +# This Dockerfile demonstrates how to build the openvino bindings using an installation of OpenVINO. |
| 2 | +# For instructions to install OpenVINO see the OpenVINO documentation, e.g. |
3 | 3 | # https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_apt.html.
|
4 |
| -FROM rust:1.50 |
| 4 | +ARG OS=ubuntu18 |
| 5 | +ARG VERSION=2020.4 |
| 6 | +FROM openvino/${OS}_runtime:${VERSION} AS builder |
5 | 7 |
|
6 |
| -# Setup Rust. |
7 |
| -RUN rustup component add rustfmt |
| 8 | +# OpenVINO's images use a default user, `openvino`, that disallows root access. |
| 9 | +USER root |
8 | 10 |
|
9 |
| -# Install OpenVINO. |
10 |
| -WORKDIR /tmp |
11 |
| -RUN wget https://apt.repos.intel.com/openvino/2020/GPG-PUB-KEY-INTEL-OPENVINO-2020 && \ |
12 |
| - echo '5f5cff8a2d26ba7de91942bd0540fa4d GPG-PUB-KEY-INTEL-OPENVINO-2020' > CHECKSUM && \ |
13 |
| - md5sum --check CHECKSUM && \ |
14 |
| - apt-key add GPG-PUB-KEY-INTEL-OPENVINO-2020 && \ |
15 |
| - echo "deb https://apt.repos.intel.com/openvino/2020 all main" | tee /etc/apt/sources.list.d/intel-openvino-2020.list && \ |
16 |
| - apt update && \ |
17 |
| - apt install -y intel-openvino-runtime-ubuntu18-2020.4.287 |
| 11 | +# Install Rust. |
| 12 | +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal |
| 13 | +ENV PATH=/root/.cargo/bin:$PATH |
| 14 | +RUN rustup component add rustfmt |
18 | 15 |
|
19 | 16 | # Install build dependencies (for bindgen).
|
20 |
| -RUN apt install -y clang libclang-dev |
| 17 | +RUN apt update && apt install -y clang libclang-dev |
21 | 18 |
|
22 |
| -# Install OpenCV (for openvino-tensor-converter). |
23 |
| -RUN apt install -y libopencv-dev libopencv-core3.2 |
24 |
| - |
25 |
| -# Copy in OpenVINO source |
26 |
| -WORKDIR /usr/src/openvino |
| 19 | +# Copy in source code. |
| 20 | +WORKDIR /usr/src/openvino-rs |
27 | 21 | COPY . .
|
28 | 22 |
|
29 |
| -# Hack to allow the opencv crate to build with an older version of the OpenCV libraries (FIXME). |
30 |
| -RUN sed -i 's/"opencv-4"/"opencv-32"/g' crates/openvino-tensor-converter/Cargo.toml |
31 |
| - |
32 | 23 | # Build openvino libraries.
|
33 |
| -WORKDIR /usr/src/openvino/inference-engine/ie_bridges/rust |
34 | 24 | RUN OPENVINO_INSTALL_DIR=/opt/intel/openvino cargo build -vv
|
35 | 25 |
|
36 |
| -# Test; note that we need to setup the library paths before using them since the OPENVINO_INSTALL_DIR can only affect |
37 |
| -# the build library search path. |
| 26 | +# Test; note that we need to setup the library paths before using them since the |
| 27 | +# OPENVINO_INSTALL_DIR can only affect the build library search path. |
38 | 28 | RUN ["/bin/bash", "-c", "source /opt/intel/openvino/bin/setupvars.sh && OPENVINO_INSTALL_DIR=/opt/intel/openvino cargo test -v"]
|
0 commit comments