2023-07-18 00:13:07 +03:00
|
|
|
# syntax=docker/dockerfile:1.4
|
2023-07-14 23:54:56 +03:00
|
|
|
|
|
|
|
|
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
|
|
# Make this a separate target so it can be built/cached optionally
|
|
|
|
|
FROM wheels as trt-wheels
|
|
|
|
|
ARG DEBIAN_FRONTEND
|
|
|
|
|
ARG TARGETARCH
|
|
|
|
|
|
|
|
|
|
# Add TensorRT wheels to another folder
|
|
|
|
|
COPY requirements-tensorrt.txt /requirements-tensorrt.txt
|
2023-07-18 00:19:13 +03:00
|
|
|
RUN mkdir -p /trt-wheels && pip3 wheel --wheel-dir=/trt-wheels -r /requirements-tensorrt.txt
|
2023-07-14 23:54:56 +03:00
|
|
|
|
|
|
|
|
# Build TensorRT-specific library
|
|
|
|
|
FROM nvcr.io/nvidia/tensorrt:23.03-py3 AS trt-deps
|
|
|
|
|
|
|
|
|
|
RUN --mount=type=bind,source=docker/tensorrt/detector/tensorrt_libyolo.sh,target=/tensorrt_libyolo.sh \
|
|
|
|
|
/tensorrt_libyolo.sh
|
|
|
|
|
|
|
|
|
|
# Frigate w/ TensorRT Support as separate image
|
2023-07-18 00:19:13 +03:00
|
|
|
FROM deps AS frigate-tensorrt
|
2023-07-14 23:54:56 +03:00
|
|
|
|
|
|
|
|
#Disable S6 Global timeout
|
|
|
|
|
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
|
|
|
|
|
|
|
|
|
|
ENV TRT_VER=8.5.3
|
|
|
|
|
ENV YOLO_MODELS="yolov7-tiny-416"
|
|
|
|
|
|
|
|
|
|
COPY --from=trt-deps /usr/local/lib/libyolo_layer.so /usr/local/lib/libyolo_layer.so
|
|
|
|
|
COPY --from=trt-deps /usr/local/src/tensorrt_demos /usr/local/src/tensorrt_demos
|
|
|
|
|
COPY docker/tensorrt/detector/rootfs/ /
|
|
|
|
|
|
|
|
|
|
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
|
|
|
|
pip3 install -U /deps/trt-wheels/*.whl && \
|
|
|
|
|
ldconfig
|
|
|
|
|
|
2023-07-18 00:19:13 +03:00
|
|
|
WORKDIR /opt/frigate/
|
|
|
|
|
COPY --from=rootfs / /
|
2023-07-18 15:08:43 +03:00
|
|
|
|
|
|
|
|
# Dev Container w/ TRT
|
|
|
|
|
FROM devcontainer AS devcontainer-trt
|
|
|
|
|
|
|
|
|
|
COPY --from=trt-deps /usr/local/lib/libyolo_layer.so /usr/local/lib/libyolo_layer.so
|
|
|
|
|
COPY --from=trt-deps /usr/local/src/tensorrt_demos /usr/local/src/tensorrt_demos
|
|
|
|
|
COPY docker/tensorrt/detector/rootfs/ /
|
|
|
|
|
COPY --from=trt-deps /usr/local/lib/libyolo_layer.so /usr/local/lib/libyolo_layer.so
|
|
|
|
|
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
|
|
|
|
pip3 install -U /deps/trt-wheels/*.whl
|