diff --git a/Dockerfile b/Dockerfile index 799261c..46390b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM nvidia/cuda:12.1.0-devel-ubuntu20.04 +FROM nvidia/cuda:12.6.1-devel-ubuntu24.04 ENV DEBIAN_FRONTEND noninteractive ENV PYTHONUNBUFFERED 1 @@ -23,24 +23,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ 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 +RUN git clone https://github.com/NixOS/patchelf -b 0.18.0 --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 +USER ubuntu +ENV HOME /home/ubuntu WORKDIR $HOME # Install python @@ -50,7 +47,7 @@ RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-instal pyenv global 3.11.4 && \ pyenv rehash -RUN pip install --upgrade pip auditwheel==5.1.2 setuptools numpy scikit-build==0.17.6 +RUN pip install --upgrade pip auditwheel==6.1.0 setuptools numpy scikit-build VOLUME [ "/input", "/output" ] WORKDIR /input @@ -59,6 +56,7 @@ 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 auditwheel-min.py repair dist/*.whl --plat manylinux_2_39_x86_64 && \ + cp wheelhouse/*.whl /output/ && \ python verify-libs.py wheelhouse/*.whl && \ cp wheelhouse/*.whl /output/ diff --git a/auditwheel-min.py b/auditwheel-min.py index e06b02d..01aded0 100644 --- a/auditwheel-min.py +++ b/auditwheel-min.py @@ -1,16 +1,20 @@ -import os import sys -from auditwheel.main import main -from auditwheel.policy import _POLICIES as POLICIES +import unittest.mock +from auditwheel.policy import WheelPolicies from auditwheel.lddtree import lddtree ldd_tree = lddtree('_skbuild/linux-x86_64-3.11/cmake-install/cv2/cv2.abi3.so') exclude_libs = [x for x in ldd_tree['libs'].keys() if not x.startswith('libopencv_')] -for p in POLICIES: - for lib in exclude_libs: - p['lib_whitelist'].append(lib) +class _WheelPolicies(WheelPolicies): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + for p in self._policies: + for lib in exclude_libs: + p['lib_whitelist'].append(lib) if __name__ == "__main__": - sys.exit(main()) + with unittest.mock.patch('auditwheel.policy.WheelPolicies', _WheelPolicies): + from auditwheel.main import main + sys.exit(main()) diff --git a/docker-build.sh b/docker-build.sh index a541515..de782bb 100755 --- a/docker-build.sh +++ b/docker-build.sh @@ -2,7 +2,7 @@ set -e if [ ! -d opencv-python ]; then - git clone https://github.com/opencv/opencv-python.git -b 80 --depth 1 --single-branch + git clone https://github.com/opencv/opencv-python.git -b 84 --depth 1 --single-branch (cd opencv-python && git submodule update --init --depth 1) fi