From 0dbf909ca6854974da36f5740d7ac30b8d8da512 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sat, 7 Jan 2023 08:07:56 -0600 Subject: [PATCH] try and further improve caching (#4947) --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6a804491a..303b406c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -144,6 +144,11 @@ RUN pip3 install -r requirements.txt COPY requirements-wheels.txt /requirements-wheels.txt RUN pip3 wheel --wheel-dir=/wheels -r requirements-wheels.txt +# 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 RUN mkdir -p /trt-wheels && pip3 wheel --wheel-dir=/trt-wheels -r requirements-tensorrt.txt @@ -263,11 +268,11 @@ COPY --from=rootfs / / # Frigate w/ TensorRT Support as separate image FROM frigate AS frigate-tensorrt -RUN --mount=type=bind,from=wheels,source=/trt-wheels,target=/deps/trt-wheels \ +RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \ pip3 install -U /deps/trt-wheels/*.whl # Dev Container w/ TRT FROM devcontainer AS devcontainer-trt -RUN --mount=type=bind,from=wheels,source=/trt-wheels,target=/deps/trt-wheels \ +RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \ pip3 install -U /deps/trt-wheels/*.whl