forked from commaai/opencv-python-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (55 loc) · 1.77 KB
/
Dockerfile
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
FROM nvidia/cuda:12.1.0-devel-ubuntu20.04
ENV DEBIAN_FRONTEND noninteractive
ENV PYTHONUNBUFFERED 1
ENV MAKEFLAGS "-j$(nproc)"
RUN apt-get update && apt-get install -y --no-install-recommends \
automake \
clang \
cmake \
curl \
git \
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libeigen3-dev \
libffi-dev \
liblzma-dev \
libbz2-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libswscale-dev \
python-openssl \
tk-dev \
xz-utils \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# Patched version of patchelf for auditwheel
RUN git clone https://github.com/nvictus/patchelf.git --depth 1
WORKDIR $HOME/patchelf
RUN ./bootstrap.sh
RUN ./configure
RUN make
RUN make install
# Create batman user
RUN useradd -ms /bin/bash batman
USER batman
ENV HOME /home/batman
WORKDIR $HOME
# Install python
ENV PATH="${HOME}/.pyenv/bin:${HOME}/.pyenv/shims:${PATH}"
RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash && \
CONFIGURE_OPTS="--enable-shared" pyenv install 3.11.4 && \
pyenv global 3.11.4 && \
pyenv rehash
RUN pip install --upgrade pip auditwheel==5.1.2 setuptools numpy scikit-build==0.17.6
VOLUME [ "/input", "/output" ]
WORKDIR /input
ENV ENABLE_HEADLESS=1
ENV CMAKE_ARGS="-DWITH_CUDA=ON -DCUDA_ARCH_BIN=6.1,7.5,8.6,8.9 -DWITH_OPENCL=OFF -DWITH_OPENCLAMDFFT=OFF -DWITH_OPENCLAMDBLAS=OFF -DOPENCV_DNN_OPENCL=OFF -DOPENCV_EXTRA_MODULES_PATH=/input/opencv_contrib/modules -DBUILD_SHARED_LIBS=ON -DBUILD_opencv_world=OFF"
CMD python setup.py bdist_wheel && \
python auditwheel-min.py repair dist/*.whl --plat manylinux_2_31_x86_64 && \
python verify-libs.py wheelhouse/*.whl && \
cp wheelhouse/*.whl /output/