Files
frigate/docker/tensorrt/trt.hcl
T
Jorge Ramirez 243172fbf4 build(tensorrt): JetPack 7 / L4T R39 image with GPU-accelerated ONNX detector
Adds a `-tensorrt-jp7` Frigate image for JetPack 7.2 / L4T R39.2 Jetson hosts,
built on nvcr.io/nvidia/tensorrt:26.02-py3-igpu (TensorRT 10.11, CUDA 13, py3.12),
keeping the existing JP6 path unchanged. ONNX Runtime GPU is built from source
(no public aarch64 onnxruntime-gpu wheel), TensorRT-Python branch is selected by
the base image, and TensorRT runtime library checks are major-version aware.

VALIDATED on a real AGX Orin (L4T R39.2 / nv_tegra_release R39 rev 2.0):
- image frigate:test-tensorrt-jp7 builds (rc=0, 16.3GB,
  sha256:c9e4d382f1603ee130ee4a7315b4f71f9461405e3785707251505e2d6d088df3)
- ONNX Runtime 1.25.1 exposes CUDAExecutionProvider, and a real Add-model
  inference RAN on the iGPU CUDA EP (functional, not just listed)
- frigate.util.model.get_ort_providers(False,"AUTO") = [CUDA, CPU] (CUDA first,
  CPU last, TensorRT EP excluded) -> the ONNX detector GPU-accelerates on JP7
- /etc/TENSORRT_VER = 10.11.0

Native `type: tensorrt` (.trt gen) + the ORT TensorRT EP stay DRAFT-GATED: the
L4T R39 host ships NO libnvdla_compiler.so (absent from host AND base image), so
`import tensorrt` and libonnxruntime_providers_tensorrt.so fail to load. ONNX
detector GPU acceleration is the supported JP7 path; native trt is deferred.

Build fixes the new noble/CUDA-13 base surfaced (beyond the plan):
- build_nginx.sh: enable deb-src for the deb822 ubuntu.sources (Ubuntu 24.04)
- tensorrt_libyolo.sh: strip -lnvToolsExt (removed in CUDA 13) + -lnvparsers
  (dropped in TensorRT 10) when those libs are absent
- docker/main: noble/py3.12 build adjustments (Dockerfile, build_sqlite_vec.sh)

Reproducible: `make -C docker/tensorrt ... local-trt-jp7` (JETPACK7_ARGS) on any
arm64 builder; built on-device only because the GPU smoke test needs the iGPU.
2026-06-27 17:14:01 -07:00

130 lines
2.9 KiB
HCL

variable "ARCH" {
default = "amd64"
}
variable "BASE_IMAGE" {
default = null
}
variable "SLIM_BASE" {
default = null
}
variable "TRT_BASE" {
default = null
}
variable "COMPUTE_LEVEL" {
default = ""
}
variable "BUILD_ONNXRUNTIME_FROM_SOURCE" {
default = "0"
}
variable "ONNXRUNTIME_VERSION" {
default = "1.25.1"
}
variable "ONNXRUNTIME_BRANCH" {
default = "rel-1.25.1"
}
variable "TENSORRT_PYTHON_BRANCH" {
default = "release/8.6"
}
variable "L4T_APT_RELEASE" {
default = ""
}
variable "JETSON_SOC_REPO" {
default = ""
}
variable "BASE_HOOK" {
# Ensure an up-to-date python 3.11 is available in jetson images
default = <<EOT
if grep -iq \"ubuntu\" /etc/os-release; then
. /etc/os-release
# Add the deadsnakes PPA repository
echo "deb https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu $VERSION_CODENAME main" >> /etc/apt/sources.list.d/deadsnakes.list
echo "deb-src https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu $VERSION_CODENAME main" >> /etc/apt/sources.list.d/deadsnakes.list
# Add deadsnakes signing key
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F23C5A6CF475977595C89F51BA6932366A755776
fi
EOT
}
target "_build_args" {
args = {
BASE_IMAGE = BASE_IMAGE,
SLIM_BASE = SLIM_BASE,
TRT_BASE = TRT_BASE,
COMPUTE_LEVEL = COMPUTE_LEVEL,
BUILD_ONNXRUNTIME_FROM_SOURCE = BUILD_ONNXRUNTIME_FROM_SOURCE,
ONNXRUNTIME_VERSION = ONNXRUNTIME_VERSION,
ONNXRUNTIME_BRANCH = ONNXRUNTIME_BRANCH,
TENSORRT_PYTHON_BRANCH = TENSORRT_PYTHON_BRANCH,
L4T_APT_RELEASE = L4T_APT_RELEASE,
JETSON_SOC_REPO = JETSON_SOC_REPO,
BASE_HOOK = BASE_HOOK
}
platforms = ["linux/${ARCH}"]
}
target wget {
dockerfile = "docker/main/Dockerfile"
target = "wget"
inherits = ["_build_args"]
}
target deps {
dockerfile = "docker/main/Dockerfile"
target = "deps"
inherits = ["_build_args"]
}
target rootfs {
dockerfile = "docker/main/Dockerfile"
target = "rootfs"
inherits = ["_build_args"]
}
target wheels {
dockerfile = "docker/main/Dockerfile"
target = "wheels"
inherits = ["_build_args"]
}
target devcontainer {
dockerfile = "docker/main/Dockerfile"
platforms = ["linux/amd64"]
target = "devcontainer"
}
target "trt-deps" {
dockerfile = "docker/tensorrt/Dockerfile.base"
context = "."
contexts = {
deps = "target:deps",
}
inherits = ["_build_args"]
}
target "tensorrt" {
dockerfile = "docker/tensorrt/Dockerfile.${ARCH}"
context = "."
contexts = {
wget = "target:wget",
wheels = "target:wheels",
deps = "target:deps",
rootfs = "target:rootfs"
}
target = "frigate-tensorrt"
inherits = ["_build_args"]
}
target "devcontainer-trt" {
dockerfile = "docker/tensorrt/Dockerfile.amd64"
context = "."
contexts = {
wheels = "target:wheels",
trt-deps = "target:trt-deps",
devcontainer = "target:devcontainer"
}
platforms = ["linux/amd64"]
target = "devcontainer-trt"
}