forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
211 lines (187 loc) · 6.88 KB
/
Dockerfile
File metadata and controls
211 lines (187 loc) · 6.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
ARG REGISTRY="docker.io"
FROM ${REGISTRY}/library/debian:10.13
USER root
# APT configuration
# WARNING: Debian 10 "Buster" is no longer officially supported,
# so repositories were moved to "archive.debian.org"
# See: https://www.debian.org/releases/
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf && \
echo 'APT::Get::Assume-Yes "true";' >> /etc/apt/apt.conf && \
echo 'APT::Get::Fix-Broken "true";' >> /etc/apt/apt.conf && \
echo 'APT::Get::no-install-recommends "true";' >> /etc/apt/apt.conf && \
sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list && \
sed -i 's/security.debian.org/archive.debian.org/g' /etc/apt/sources.list && \
sed -i '/stretch-updates/d' /etc/apt/sources.list
ENV DEBIAN_FRONTEND="noninteractive" \
TZ="Europe/London"
RUN dpkg --add-architecture armhf && apt-get update && \
apt-get install \
software-properties-common \
curl \
git \
gpg-agent \
tzdata \
# parallel gzip
pigz \
# Python
python3 \
python3-pip \
python3-dev \
python3-venv \
python3-distutils \
libhdf5-dev \
# For building Python from source
build-essential \
libgdbm-dev \
libc6-dev \
libssl-dev \
libffi-dev \
zlib1g-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
libncurses5-dev \
libncursesw5-dev \
xz-utils \
tk-dev \
libxml2-dev \
libxmlsec1-dev \
liblzma-dev \
wget \
libavcodec58:armhf \
libusb-1.0-0-dev:armhf \
libboost-regex-dev:armhf \
crossbuild-essential-armhf \
libgtk-3-dev:armhf \
libavcodec-dev:armhf \
libavformat-dev:armhf \
libswscale-dev:armhf \
libgstreamer1.0-dev:armhf \
libpython-dev:armhf \
libgstreamer-plugins-base1.0-dev:armhf \
zlib1g-dev:armhf \
nlohmann-json-dev \
libgflags-dev:armhf \
libtbb-dev:armhf \
libffi-dev:armhf \
# Compilers
gcc-arm-linux-gnueabihf \
g++-arm-linux-gnueabihf \
&& \
rm -rf /var/lib/apt/lists/*
# Install build dependencies
ADD install_build_dependencies.sh /install_build_dependencies.sh
RUN chmod +x /install_build_dependencies.sh && \
bash -e /install_build_dependencies.sh && \
rm -rf /var/lib/apt/lists/*
# Install sscache
ARG SCCACHE_VERSION="v0.7.5"
ENV SCCACHE_HOME="/opt/sccache" \
SCCACHE_PATH="/opt/sccache/sccache"
RUN mkdir ${SCCACHE_HOME} && cd ${SCCACHE_HOME} && \
SCCACHE_ARCHIVE="sccache-${SCCACHE_VERSION}-aarch64-unknown-linux-musl.tar.gz" && \
curl -SLO https://github.com/mozilla/sccache/releases/download/${SCCACHE_VERSION}/${SCCACHE_ARCHIVE} && \
tar -xzf ${SCCACHE_ARCHIVE} --strip-components=1 && rm ${SCCACHE_ARCHIVE}
ENV PATH="$SCCACHE_HOME:$PATH"
# Build Pythons
# Python 3.10
# To cross-compile Python 3.10 we need to first compile it for the host
RUN wget https://www.python.org/ftp/python/3.10.16/Python-3.10.16.tar.xz
RUN tar -xf Python-3.10.16.tar.xz && \
cd Python-3.10.16 && \
./configure --enable-optimizations && \
make -j $(nproc) && \
make altinstall
# Compile Python 3.10 for ARM
RUN cd Python-3.10.16 && make distclean && \
./configure \
--host=arm-linux-gnueabihf \
--build=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) \
--disable-ipv6 \
--enable-shared \
--prefix=/opt/python3.10_arm \
ac_cv_file__dev_ptmx=no \
ac_cv_file__dev_ptc=no && \
make -j $(nproc) && make altinstall
# Upgrade openssl to 3.3.1 for Python3.11 - 3.13 ssl module
RUN wget https://www.openssl.org/source/openssl-3.3.1.tar.gz && \
tar -zxf openssl-3.3.1.tar.gz && \
cd openssl-3.3.1 && \
./config && \
make install && \
ln -sf /usr/local/bin/openssl /usr/bin/openssl && \
echo /usr/local/lib64 | tee /etc/ld.so.conf.d/custom.conf && \
ldconfig && \
openssl version
# Python 3.11
# To cross-compile Python 3.11 we need to first compile it for the host
RUN wget https://www.python.org/ftp/python/3.11.9/Python-3.11.9.tar.xz
RUN tar -xf Python-3.11.9.tar.xz && \
cd Python-3.11.9 && \
LDFLAGS="-L/usr/local/lib64" ./configure --with-openssl=/usr/local --with-openssl-rpath=auto && \
make -j $(nproc) && \
make altinstall
# Compile Python 3.11 for ARM
RUN cd Python-3.11.9 && make distclean && \
./configure \
--host=arm-linux-gnueabihf \
--build=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) \
--disable-ipv6 \
--enable-shared \
--with-build-python \
--prefix=/opt/python3.11_arm \
ac_cv_file__dev_ptmx=no \
ac_cv_file__dev_ptc=no && \
make -j $(nproc) && make altinstall
# Python 3.12
# To cross-compile Python 3.12 we need to first compile it for the host
RUN wget https://www.python.org/ftp/python/3.12.9/Python-3.12.9.tar.xz
RUN tar -xf Python-3.12.9.tar.xz && \
cd Python-3.12.9 && \
LDFLAGS="-L/usr/local/lib64" ./configure --with-openssl=/usr/local --with-openssl-rpath=auto && \
make -j $(nproc) && \
make altinstall
# Compile Python 3.12 for ARM
RUN cd Python-3.12.9 && make distclean && \
./configure \
--host=arm-linux-gnueabihf \
--build=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) \
--disable-ipv6 \
--enable-shared \
--with-build-python \
--prefix=/opt/python3.12_arm \
ac_cv_file__dev_ptmx=no \
ac_cv_file__dev_ptc=no && \
make -j $(nproc) && make altinstall
# Python 3.13
# To cross-compile Python 3.13 we need to first compile it for the host
RUN wget https://www.python.org/ftp/python/3.13.2/Python-3.13.2.tar.xz
RUN tar -xf Python-3.13.2.tar.xz && \
cd Python-3.13.2 && \
LDFLAGS="-L/usr/local/lib64" ./configure --with-openssl=/usr/local --with-openssl-rpath=auto && \
make -j $(nproc) && \
make altinstall
# Compile Python 3.13 for ARM
RUN cd Python-3.13.2 && make distclean && \
./configure \
--host=arm-linux-gnueabihf \
--build=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) \
--disable-ipv6 \
--enable-shared \
--with-build-python \
--prefix=/opt/python3.13_arm \
ac_cv_file__dev_ptmx=no \
ac_cv_file__dev_ptc=no && \
make -j $(nproc) && make altinstall
# Setup pip
ENV PIP_VERSION="24.0"
RUN python3 -m pip install --upgrade pip==${PIP_VERSION} && \
python3.10 -m pip install --upgrade pip==${PIP_VERSION} && \
python3.11 -m pip install --upgrade pip==${PIP_VERSION} && \
python3.12 -m pip install --upgrade pip==${PIP_VERSION} && \
python3.13 -m pip install --upgrade pip==${PIP_VERSION}
# Use Python 3.11 as default
# Using venv here because other methods to switch the default Python break both system and wheels build
RUN python3.11 -m venv venv
ENV PATH="/venv/bin:$SCCACHE_HOME:$PATH"
ENV PIP_CACHE_DIR=/mount/caches/pip/linux/${PIP_VERSION}