frigate/docker/Dockerfile.l4t.base

139 lines
4.3 KiB
Docker

ARG NGINX_VERSION
FROM blakeblackshear/frigate-nginx-l4t:${NGINX_VERSION} as nginx
FROM frigate-web as web
FROM nvcr.io/nvidia/l4t-tensorrt:r8.0.1-runtime as wheels
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -qq update \
&& apt-get -qq install -y \
python3.8-dev \
wget \
# opencv dependencies
build-essential cmake git pkg-config libgtk-3-dev
RUN apt-get -qq install -y \
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev
RUN apt-get -qq install -y \
gfortran openexr libatlas-base-dev libssl-dev\
libtbb2 libtbb-dev libdc1394-22-dev libopenexr-dev
RUN apt-get -qq install -y \
libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev \
# scipy dependencies
gcc gfortran libopenblas-dev liblapack-dev cython
RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
&& python3 get-pip.py
RUN pip3 install scikit-build
RUN pip3 wheel --wheel-dir=/wheels \
opencv-python-headless \
numpy \
imutils \
scipy \
psutil \
Flask \
paho-mqtt \
PyYAML \
matplotlib \
click \
setproctitle \
peewee
FROM nvcr.io/nvidia/l4t-tensorrt:r8.0.1-runtime
ENV DEBIAN_FRONTEND=noninteractive
RUN \
apt-get update && apt-get install -y gnupg
RUN \
apt-key adv --fetch-key https://repo.download.nvidia.com/jetson/jetson-ota-public.asc && \
echo "deb https://repo.download.nvidia.com/jetson/ffmpeg main main" | tee -a /etc/apt/sources.list && \
echo "deb-src https://repo.download.nvidia.com/jetson/ffmpeg main main" | tee -a /etc/apt/sources.list && \
apt-get -qq update && \
apt-get -qq install ffmpeg
COPY --from=wheels /wheels/. /wheels/
ENV FLASK_ENV=development
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -qq update \
&& apt-get upgrade -y \
&& apt-get -qq install --no-install-recommends -y gnupg wget unzip tzdata libxml2
RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
&& python3 get-pip.py && \
pip3 install -U /wheels/*.whl
RUN \
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn apt-key adv --fetch-keys https://packages.cloud.google.com/apt/doc/apt-key.gpg \
&& echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" > /etc/apt/sources.list.d/coral-edgetpu.list \
&& echo "libedgetpu1-max libedgetpu/accepted-eula select true" | debconf-set-selections \
&& apt-get -qq update
RUN \
apt-get -qq install --no-install-recommends -y libedgetpu1-max python3-tflite-runtime python3-pycoral \
&& rm -rf /var/lib/apt/lists/* /wheels \
&& (apt-get autoremove -y; apt-get autoclean -y)
RUN pip3 install \
peewee_migrate \
pydantic \
zeroconf \
ws4py
RUN \
apt-get update && apt-get install -y gstreamer1.0-tools gstreamer1.0-alsa \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly
RUN \
apt-get install -y git libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
libgstreamer-plugins-good1.0-dev \
libgstreamer-plugins-bad1.0-dev
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/aarch64-linux-gnu/tegra
RUN wget -q https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite -O /edgetpu_model.tflite
RUN wget -q https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess.tflite -O /cpu_model.tflite
COPY --from=nginx /usr/local/nginx/ /usr/local/nginx/
COPY --from=web /opt/frigate/build /opt/frigate/web/
# install TRT dependencies
RUN apt-get update && apt-get install -y git sudo
ADD docker/l4t/ /l4t/
RUN /l4t/install_pycuda.sh
# s6-overlay
COPY docker/rootfs/ /
ADD https://github.com/just-containers/s6-overlay/releases/download/v2.2.0.3/s6-overlay-aarch64-installer /tmp/
RUN chmod +x /tmp/s6-overlay-aarch64-installer && /tmp/s6-overlay-aarch64-installer /
COPY labelmap.txt /labelmap.txt
COPY detect.tflite /detect.tflite
# edgetpu experiments
RUN wget -q https://github.com/Azure/Azure-AI-Camp/releases/download/v1.0/yolov4-tiny.tflite -O /yolov4-tiny.tflite
# TRT Yolo4 Plugin
ADD .l4t_assets /yolo4/
EXPOSE 5000
EXPOSE 1935
WORKDIR /opt/frigate/
ADD frigate frigate/
ADD migrations migrations/
ENTRYPOINT ["/init"]
CMD ["python3", "-u", "-m", "frigate"]