Dockerfile 6.25 KB
Newer Older
GONZALES ZUNIGA Juan Diego's avatar
GONZALES ZUNIGA Juan Diego committed
1
2
3
4
# Basic docker installation of openVino
# Replace openvinoTar with the openvinoversion
# The openvinoTar is erased after installation 

Ukhu's avatar
Ukhu committed
5
FROM ubuntu:18.04
GONZALES ZUNIGA Juan Diego's avatar
GONZALES ZUNIGA Juan Diego committed
6
MAINTAINER jdg:juan-diego.gonzales-zuniga@kontron.com
Ukhu's avatar
Ukhu committed
7
8
9
10
11

WORKDIR /

SHELL ["/bin/bash", "-xo", "pipefail", "-c"]

Ukhu's avatar
Ukhu committed
12

Ukhu's avatar
Ukhu committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Dependencies
ARG DEPENDENCIES="autoconf \
		  automake \
		  build-essential \
		  cmake \
		  cpio \
		  curl \
		  gnupg2 \
		  libdrm2 \
		  libglib2.0-0 \
		  lsb-release \
		  libgtk-3-0 \
		  libtool \
		  udev \
		  unzip \
Ukhu's avatar
Ukhu committed
28
		  dos2unix \
Ukhu's avatar
Ukhu committed
29
30
31
32
		  sudo \
		  wget \
		  git"

Ukhu's avatar
Ukhu committed
33
RUN apt-get update && \ 
Ukhu's avatar
Ukhu committed
34
35
36
    apt-get install -y --no-install-recommends ${DEPENDENCIES} && \
    rm -rf /var/lib/apt/lists/*

Ukhu's avatar
Ukhu committed
37
38
39
40
41
42
43
44
45
46
47
48
49
WORKDIR /thirdparty
RUN sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \
    apt-get update && \
    apt-get source ${DEPENDENCIES} && \
    rm -rf /var/lib/apt/lists/*

# setup Python
ENV PYTHON python3.6
RUN apt-get update && \
    apt-get install -y --no-install-recommends python3-pip python3-dev lib${PYTHON} && \
    rm -rf /var/lib/apt/lists/*

# Openvino Version and copy from host
Ukhu's avatar
Ukhu committed
50
51
52

ARG openvinoTar=l_openvino_toolkit_p_2021.1.110
ENV INTEL_OPENVINO_DIR=/opt/intel/openvino_2021.1.110
53
ARG TEMP_DIR=/tmp/openvino_installer
Ukhu's avatar
Ukhu committed
54

Ukhu's avatar
Ukhu committed
55
WORKDIR ${TEMP_DIR} 
56
COPY ./$openvinoTar.tgz $TEMP_DIR
Ukhu's avatar
Ukhu committed
57
58
59

# install product by installation script

Ukhu's avatar
Ukhu committed
60
61
ENV TZ=Europe/Kiev
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
Ukhu's avatar
Ukhu committed
62
63
64
RUN tar -xzf ${TEMP_DIR}/*.tgz --strip 1
RUN sed -i 's/decline/accept/g' silent.cfg && \
    ${TEMP_DIR}/install.sh -s silent.cfg && \
Ukhu's avatar
Ukhu committed
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
    ${INTEL_OPENVINO_DIR}/install_dependencies/install_openvino_dependencies.sh && \
    cp ${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ && \
    ldconfig

WORKDIR /tmp
RUN rm -rf ${TEMP_DIR}

# for GPU
ARG GMMLIB=19.3.2
ARG IGC_CORE=1.0.2597
ARG IGC_OPENCL=1.0.2597
ARG INTEL_OPENCL=19.41.14441
ARG INTEL_OCLOC=19.41.14441
ARG TEMP_DIR=/tmp/opencl

WORKDIR ${TEMP_DIR}
RUN apt-get update && \
    apt-get install -y --no-install-recommends ocl-icd-libopencl1=2.2.11-1ubuntu1 && \
    rm -rf /var/lib/apt/lists/* && \
    curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-gmmlib_${GMMLIB}_amd64.deb" --output "intel-gmmlib_${GMMLIB}_amd64.deb" && \
    curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-core_${IGC_CORE}_amd64.deb" --output "intel-igc-core_${IGC_CORE}_amd64.deb" && \
    curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-opencl_${IGC_OPENCL}_amd64.deb" --output "intel-igc-opencl_${IGC_OPENCL}_amd64.deb" && \
    curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-opencl_${INTEL_OPENCL}_amd64.deb" --output "intel-opencl_${INTEL_OPENCL}_amd64.deb" && \
    curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-ocloc_${INTEL_OCLOC}_amd64.deb" --output "intel-ocloc_${INTEL_OCLOC}_amd64.deb" && \
    dpkg -i ${TEMP_DIR}/*.deb && \
    ldconfig && \
    rm -rf ${TEMP_DIR}

# for VPU
WORKDIR /opt
RUN curl -L https://github.com/libusb/libusb/archive/v1.0.22.zip --output v1.0.22.zip && \
    unzip v1.0.22.zip

WORKDIR /opt/libusb-1.0.22
RUN ./bootstrap.sh && \
    ./configure --disable-udev --enable-shared && \
    make -j4
RUN apt-get update && \
    apt-get install -y --no-install-recommends libusb-1.0-0-dev=2:1.0.21-2 && \
    rm -rf /var/lib/apt/lists/*
Ukhu's avatar
Ukhu committed
105

Ukhu's avatar
Ukhu committed
106
107
108
109
110
111
WORKDIR /opt/libusb-1.0.22/libusb
RUN /bin/mkdir -p '/usr/local/lib' && \
    /bin/bash ../libtool   --mode=install /usr/bin/install -c   libusb-1.0.la '/usr/local/lib' && \
    /bin/mkdir -p '/usr/local/include/libusb-1.0' && \
    /usr/bin/install -c -m 644 libusb.h '/usr/local/include/libusb-1.0' && \
    /bin/mkdir -p '/usr/local/lib/pkgconfig'
Ukhu's avatar
Ukhu committed
112

Ukhu's avatar
Ukhu committed
113
114
115
WORKDIR /opt/libusb-1.0.22/
RUN /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \
    ldconfig
Ukhu's avatar
Ukhu committed
116

Ukhu's avatar
Ukhu committed
117
118
119
120
121
122
123
124
125
126
# for HDDL
WORKDIR /tmp
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        libboost-filesystem1.65-dev=1.65.1+dfsg-0ubuntu5 \
        libboost-thread1.65-dev=1.65.1+dfsg-0ubuntu5 \
        libjson-c3=0.12.1-1.3 libxxf86vm-dev=1:1.1.4-1 && \
    rm -rf /var/lib/apt/lists/*

# dev package dependencies
Ukhu's avatar
Ukhu committed
127
128
129
WORKDIR /tmp

RUN ${PYTHON} -m pip install --no-cache-dir setuptools && \
Ukhu's avatar
Ukhu committed
130
131
    ${PYTHON} -m pip install --upgrade pip && \
    ${PYTHON} -m pip install tensorflow==1.15.3 && \
Ukhu's avatar
Ukhu committed
132
133
    find "${INTEL_OPENVINO_DIR}/" -type f -name "*requirements*.*" -path "*/${PYTHON}/*" -exec ${PYTHON} -m pip install --no-cache-dir -r "{}" \; && \
    find "${INTEL_OPENVINO_DIR}/" -type f -name "*requirements*.*" -not -path "*/post_training_optimization_toolkit/*" -not -name "*windows.txt"  -not -name "*ubuntu16.txt" -not -path "*/python3*/*" -not -path "*/python2*/*" -exec ${PYTHON} -m pip install --no-cache-dir -r "{}" \;
Ukhu's avatar
Ukhu committed
134

Ukhu's avatar
Ukhu committed
135
136
137
138
WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker
RUN source ${INTEL_OPENVINO_DIR}/bin/setupvars.sh && \
    ${PYTHON} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/requirements.in && \
    ${PYTHON} ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/setup.py install
Ukhu's avatar
Ukhu committed
139

Ukhu's avatar
Ukhu committed
140
141
142
143
144
WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit
RUN if [ -f requirements.txt ]; then \
        ${PYTHON} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit/requirements.txt && \
        ${PYTHON} ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit/setup.py install; \
    fi;
145

Ukhu's avatar
Ukhu committed
146
147
148
149
150
151
152
# Post-installation cleanup and setting up OpenVINO environment variables
RUN if [ -f "${INTEL_OPENVINO_DIR}"/bin/setupvars.sh ]; then \
        printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /root/.bashrc; \
    fi;
RUN find "${INTEL_OPENVINO_DIR}/" -name "*.*sh" -type f -exec dos2unix {} \;

RUN ${INTEL_OPENVINO_DIR}/deployment_tools/demo/demo_benchmark_app.sh
Ukhu's avatar
Ukhu committed
153
154
155
RUN ln -s ${INTEL_OPENVINO_DIR} /opt/intel/openvino


TigerLake's avatar
fixes    
TigerLake committed
156
157
# Add video group
RUN usermod -aG video root
Ukhu's avatar
Ukhu committed
158

Ukhu's avatar
Ukhu committed
159
160
WORKDIR ${INTEL_OPENVINO_DIR}

161
CMD ["/bin/bash"]