robocar-oak-camera/Dockerfile

65 lines
2.0 KiB
Docker
Raw Normal View History

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
2022-01-15 17:42:14 +00:00
# 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
2022-01-15 17:42:14 +00:00
COPY --from=builder-lib-usb /usr/local/lib/ /usr/local/lib/
2022-01-15 17:42:14 +00:00
RUN pip3 install numpy
2022-01-17 22:09:25 +00:00
ADD requirements.txt requirements.txt
2022-01-15 17:42:14 +00:00
RUN pip3 install -r requirements.txt
2022-01-17 22:09:25 +00:00
ADD events events
ADD camera camera
ADD setup.cfg setup.cfg
ADD setup.py setup.py
2022-01-15 17:42:14 +00:00
ENV PYTHON_EGG_CACHE=/tmp/cache
2022-01-17 22:09:25 +00:00
RUN python3 setup.py install
2022-01-15 17:42:14 +00:00
RUN echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | tee /etc/udev/rules.d/80-movidius.rules
2022-01-15 17:42:14 +00:00
WORKDIR /tmp
USER 1234
ENTRYPOINT ["/usr/local/bin/rc-oak-camera"]