robocar-oak-camera/Dockerfile

65 lines
2.0 KiB
Docker

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 libgl1 libglib2.0-0
COPY --from=builder-lib-usb /usr/local/lib/ /usr/local/lib/
RUN pip3 install numpy
ADD requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
ADD events events
ADD camera camera
ADD setup.cfg setup.cfg
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
ENTRYPOINT ["/usr/local/bin/rc-oak-camera"]