mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-13 22:55:26 +03:00
Support building docker image for amd64 and arm64
This commit is contained in:
parent
62c29be064
commit
3a64402927
@ -17,20 +17,27 @@ RUN mkdir /h8l-wheels
|
|||||||
RUN pip3 wheel --wheel-dir=/h8l-wheels -c /requirements-wheels.txt -r /requirements-wheels-h8l.txt
|
RUN pip3 wheel --wheel-dir=/h8l-wheels -c /requirements-wheels.txt -r /requirements-wheels-h8l.txt
|
||||||
|
|
||||||
# Build HailoRT and create wheel
|
# Build HailoRT and create wheel
|
||||||
FROM deps AS build-hailort
|
FROM wheels AS build-hailort
|
||||||
|
ARG TARGETARCH
|
||||||
|
|
||||||
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
|
||||||
# Install necessary APT packages
|
# Install necessary APT packages
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get -qq update \
|
||||||
build-essential \
|
&& apt-get -qq install -y \
|
||||||
cmake \
|
apt-transport-https \
|
||||||
git \
|
gnupg \
|
||||||
wget \
|
wget \
|
||||||
python3-dev \
|
# the key fingerprint can be obtained from https://ftp-master.debian.org/keys.html
|
||||||
gcc-9 \
|
&& wget -qO- "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA4285295FC7B1A81600062A9605C66F00D6C9793" | \
|
||||||
g++-9 \
|
gpg --dearmor > /usr/share/keyrings/debian-archive-bullseye-stable.gpg \
|
||||||
libzmq3-dev \
|
&& echo "deb [signed-by=/usr/share/keyrings/debian-archive-bullseye-stable.gpg] http://deb.debian.org/debian bullseye main contrib non-free" | \
|
||||||
pciutils \
|
tee /etc/apt/sources.list.d/debian-bullseye-nonfree.list \
|
||||||
rsync \
|
&& apt-get -qq update \
|
||||||
|
&& apt-get -qq install -y \
|
||||||
|
python3.9 \
|
||||||
|
python3.9-dev \
|
||||||
|
build-essential cmake git \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Extract Python version and set environment variables
|
# Extract Python version and set environment variables
|
||||||
@ -39,9 +46,6 @@ RUN PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}' | cut -d. -f1,2)
|
|||||||
echo "PYTHON_VERSION=$PYTHON_VERSION" > /etc/environment && \
|
echo "PYTHON_VERSION=$PYTHON_VERSION" > /etc/environment && \
|
||||||
echo "PYTHON_VERSION_NO_DOT=$PYTHON_VERSION_NO_DOT" >> /etc/environment
|
echo "PYTHON_VERSION_NO_DOT=$PYTHON_VERSION_NO_DOT" >> /etc/environment
|
||||||
|
|
||||||
#ENV PYTHON_VER=$PYTHON_VERSION
|
|
||||||
#ENV PYTHON_VER_NO_DOT=$PYTHON_VERSION_NO_DOT
|
|
||||||
|
|
||||||
# Clone and build HailoRT
|
# Clone and build HailoRT
|
||||||
RUN . /etc/environment && \
|
RUN . /etc/environment && \
|
||||||
git clone https://github.com/hailo-ai/hailort.git /opt/hailort && \
|
git clone https://github.com/hailo-ai/hailort.git /opt/hailort && \
|
||||||
@ -50,7 +54,7 @@ RUN . /etc/environment && \
|
|||||||
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release -DHAILO_BUILD_PYBIND=1 -DPYBIND11_PYTHON_VERSION=${PYTHON_VERSION} && \
|
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release -DHAILO_BUILD_PYBIND=1 -DPYBIND11_PYTHON_VERSION=${PYTHON_VERSION} && \
|
||||||
cmake --build build --config release --target libhailort && \
|
cmake --build build --config release --target libhailort && \
|
||||||
cmake --build build --config release --target _pyhailort && \
|
cmake --build build --config release --target _pyhailort && \
|
||||||
cp build/hailort/libhailort/bindings/python/src/_pyhailort.cpython-${PYTHON_VERSION_NO_DOT}-aarch64-linux-gnu.so hailort/libhailort/bindings/python/platform/hailo_platform/pyhailort/ && \
|
cp build/hailort/libhailort/bindings/python/src/_pyhailort.cpython-${PYTHON_VERSION_NO_DOT}-$(if [ $TARGETARCH == "amd64" ]; then echo 'x86_64'; else echo 'aarch64'; fi )-linux-gnu.so hailort/libhailort/bindings/python/platform/hailo_platform/pyhailort/ && \
|
||||||
cp build/hailort/libhailort/src/libhailort.so hailort/libhailort/bindings/python/platform/hailo_platform/pyhailort/
|
cp build/hailort/libhailort/src/libhailort.so hailort/libhailort/bindings/python/platform/hailo_platform/pyhailort/
|
||||||
|
|
||||||
RUN ls -ahl /opt/hailort/build/hailort/libhailort/src/
|
RUN ls -ahl /opt/hailort/build/hailort/libhailort/src/
|
||||||
@ -94,7 +98,7 @@ COPY --from=rootfs / /
|
|||||||
|
|
||||||
# Set environment variables for Hailo SDK
|
# Set environment variables for Hailo SDK
|
||||||
ENV PATH="/opt/hailort/bin:${PATH}"
|
ENV PATH="/opt/hailort/bin:${PATH}"
|
||||||
ENV LD_LIBRARY_PATH="/usr/lib/aarch64-linux-gnu:${LD_LIBRARY_PATH}"
|
ENV LD_LIBRARY_PATH="/usr/lib/$(if [ $TARGETARCH == "amd64" ]; then echo 'x86_64'; else echo 'aarch64'; fi )-linux-gnu:${LD_LIBRARY_PATH}"
|
||||||
|
|
||||||
# Set workdir
|
# Set workdir
|
||||||
WORKDIR /opt/frigate/
|
WORKDIR /opt/frigate/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user