diff --git a/Dockerfile b/Dockerfile index 7d6fef2..bfda45c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,45 @@ +FROM docker.io/library/debian as builder-lib-usb +ARG BUILD_DEPENDENCIES="autoconf \ + automake \ + build-essential \ + libtool \ + unzip \ + curl \ + ca-certificates \ + udev" +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${BUILD_DEPENDENCIES} && \ + rm -rf /var/lib/apt/lists/* + +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 + +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' + +#WORKDIR /opt/libusb-1.0.22/ +#RUN /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \ +# cp /opt/intel/openvino_2021/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ && \ +# ldconfig + FROM docker.io/library/python:3.9-slim # Configure piwheels repo to use pre-compiled numpy wheels for arm RUN echo -n "[global]\nextra-index-url=https://www.piwheels.org/simple\n" >> /etc/pip.conf -RUN apt-get update && apt-get install -y libusb-1.0-0 libgl1 libglib2.0-0 +RUN apt-get update && apt-get install -y libgl1 libglib2.0-0 +COPY --from=builder-lib-usb /usr/local/lib/ /usr/local/lib/ RUN pip3 install numpy @@ -21,6 +56,8 @@ ADD setup.py setup.py ENV PYTHON_EGG_CACHE=/tmp/cache RUN python3 setup.py install +RUN echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | tee /etc/udev/rules.d/80-movidius.rules + WORKDIR /tmp USER 1234