[Feat] Add dependencies installation in docker build

- Add runtime library and wheels installation in main/Dockerfile
- Add model.synap(default model, transfer from mobilenet_224full80) in docker/synap1680
This commit is contained in:
GaryHuang-ASUS 2025-09-12 09:11:14 +08:00
parent 4fb5a22817
commit 9514cebce9
7 changed files with 115 additions and 0 deletions

View File

@ -195,6 +195,9 @@ RUN pip3 wheel --wheel-dir=/wheels -r /requirements-wheels.txt && \
# Install HailoRT & Wheels # Install HailoRT & Wheels
RUN --mount=type=bind,source=docker/main/install_hailort.sh,target=/deps/install_hailort.sh \ RUN --mount=type=bind,source=docker/main/install_hailort.sh,target=/deps/install_hailort.sh \
/deps/install_hailort.sh /deps/install_hailort.sh
#Install Synaptics SL1680 runtime library and wheels
RUN --mount=type=bind,source=docker/main/install_synap1680.sh,target=/deps/install_synap1680.sh \
/deps/install_synap1680.sh
# Collect deps in a single layer # Collect deps in a single layer
FROM scratch AS deps-rootfs FROM scratch AS deps-rootfs

View File

@ -0,0 +1,13 @@
#!/bin/bash
set -euxo pipefail
if [[ "${TARGETARCH}" == "amd64" ]]; then
arch="x86_64"
elif [[ "${TARGETARCH}" == "arm64" ]]; then
arch="aarch64"
fi
wget -qO- "https://github.com/GaryHuang-ASUS/frigate-synaptics-rt/releases/download/v1.5.0-1.0/synaptics-rt-1.0.tar" | tar -C / -xzf -
wget -P /wheels/ "https://github.com/synaptics-synap/synap-python/releases/download/v0.0.4-preview/synap_python-0.0.4-cp311-cp311-manylinux_2_35_aarch64.whl"

View File

@ -0,0 +1,15 @@
# syntax=docker/dockerfile:1.4
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
ARG DEBIAN_FRONTEND=noninteractive
FROM deps AS synap1680-deps
ARG TARGETARCH
# Install dependencies
RUN --mount=type=bind,source=docker/synap1680/install_deps.sh,target=/deps/install_deps.sh \
/deps/install_deps.sh
WORKDIR /opt/frigate/
COPY --from=rootfs / /
ADD https://raw.githubusercontent.com/synaptics-astra/synap-release/v1.5.0/models/dolphin/object_detection/coco/model/mobilenet224_full80/model.synap /model.synap

View File

@ -0,0 +1,34 @@
# syntax=docker/dockerfile:1.4
ARG DEBIAN_FRONTEND=noninteractive
FROM --platform=linux/amd64 debian:12-slim AS poky-toolchain
ARG DEBIAN_FRONTEND
RUN apt-get update \
&& apt-get install -y wget xz-utils \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /tmp
RUN wget -O /tmp/toolchain.sh.000 https://github.com/synaptics-astra/sdk/releases/download/v1.5.0/sl1680_oobe-poky-glibc-x86_64-astra-media-oobe-cortexa73-sl1680-toolchain-4.0.17.sh.000 \
&& wget -O /tmp/toolchain.sh.001 https://github.com/synaptics-astra/sdk/releases/download/v1.5.0/sl1680_oobe-poky-glibc-x86_64-astra-media-oobe-cortexa73-sl1680-toolchain-4.0.17.sh.001 \
&& cat /tmp/toolchain.sh.* > /tmp/toolchain.sh \
&& chmod +x /tmp/toolchain.sh \
&& /tmp/toolchain.sh -y -d /opt/poky/4.0.17
FROM deps AS synap1680-deps
ARG TARGETARCH
# Install dependencies
RUN --mount=type=bind,source=docker/synap1680/install_deps.sh,target=/deps/install_deps.sh \
/deps/install_deps.sh
WORKDIR /opt/frigate/
COPY --from=rootfs / /
COPY --from=poky-toolchain /opt/poky/4.0.17/sysroots/cortexa73-poky-linux/usr/lib/libtim-vx.so /rootfs/usr/lib/
COPY --from=poky-toolchain /opt/poky/4.0.17/sysroots/cortexa73-poky-linux/usr/lib/libtensorflow-lite.so /rootfs/usr/lib/
COPY --from=poky-toolchain /opt/poky/4.0.17/sysroots/cortexa73-poky-linux/usr/lib/libvx_delegate.so /rootfs/usr/lib/
COPY --from=poky-toolchain /opt/poky/4.0.17/sysroots/cortexa73-poky-linux/usr/lib/libsynapnb.so /rootfs/usr/lib/
COPY --from=poky-toolchain /opt/poky/4.0.17/sysroots/cortexa73-poky-linux/usr/lib/libebg_utils.so /rootfs/usr/lib/
COPY --from=poky-toolchain /opt/poky/4.0.17/sysroots/cortexa73-poky-linux/usr/lib/libovxlib.so /rootfs/usr/lib/
ADD https://github.com/synaptics-astra/synap-release/blob/v1.5.0/models/dolphin/object_detection/coco/model/mobilenet224_full80/model.synap /model.synap

View File

@ -0,0 +1,15 @@
#!/bin/bash
set -euxo pipefail
apt-get -qq update
if [[ "${TARGETARCH}" == "amd64" ]]; then
arch="x86_64"
elif [[ "${TARGETARCH}" == "arm64" ]]; then
arch="aarch64"
fi
wget -qO- "https://github.com/GaryHuang-ASUS/frigate-synaptics-rt/releases/download/v1.5.0-1.0/synaptics-rt-1.0.tar" | tar -C / -xzf -
wget -P /wheels/ "https://github.com/synaptics-synap/synap-python/releases/download/v0.0.4-preview/synap_python-0.0.4-cp311-cp311-manylinux_2_35_aarch64.whl"
cp /rootfs/usr/local/lib/* /usr/local/lib

View File

@ -0,0 +1,20 @@
target deps {
dockerfile = "docker/main/Dockerfile"
platforms = ["linux/arm64"]
target = "deps"
}
target rootfs {
dockerfile = "docker/main/Dockerfile"
platforms = ["linux/arm64"]
target = "rootfs"
}
target synap1680 {
dockerfile = "docker/synap1680/Dockerfile"
contexts = {
deps = "target:deps",
rootfs = "target:rootfs"
}
platforms = ["linux/arm64"]
}

View File

@ -0,0 +1,15 @@
BOARDS += synap1680
local-synap1680: version
docker buildx bake --file=docker/synap1680/synap1680.hcl synap1680 \
--set synap1680.tags=frigate:latest-synap1680 \
--load
build-synap1680: version
docker buildx bake --file=docker/synap1680/synap1680.hcl synap1680 \
--set synap1680.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-synap1680
push-synap1680: build-synap1680
docker buildx bake --file=docker/synap1680/synap1680.hcl synap1680 \
--set synap1680.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-synap1680 \
--push