From 2d08708c3bfbc38d0f30606cf5564b2262749c34 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Tue, 13 Oct 2020 11:56:28 +0200 Subject: [PATCH] Offload dockermachines into core (#41756) --- azure-pipelines-release.yml | 4 +-- machine/intel-nuc | 34 +++++++++++++++++++++ machine/odroid-c2 | 34 +++++++++++++++++++++ machine/odroid-n2 | 34 +++++++++++++++++++++ machine/odroid-xu | 34 +++++++++++++++++++++ machine/qemuarm | 33 ++++++++++++++++++++ machine/qemuarm-64 | 33 ++++++++++++++++++++ machine/qemux86 | 33 ++++++++++++++++++++ machine/qemux86-64 | 33 ++++++++++++++++++++ machine/raspberrypi | 61 +++++++++++++++++++++++++++++++++++++ machine/raspberrypi2 | 61 +++++++++++++++++++++++++++++++++++++ machine/raspberrypi3 | 61 +++++++++++++++++++++++++++++++++++++ machine/raspberrypi3-64 | 61 +++++++++++++++++++++++++++++++++++++ machine/raspberrypi4 | 61 +++++++++++++++++++++++++++++++++++++ machine/raspberrypi4-64 | 61 +++++++++++++++++++++++++++++++++++++ machine/tinker | 48 +++++++++++++++++++++++++++++ 16 files changed, 684 insertions(+), 2 deletions(-) create mode 100644 machine/intel-nuc create mode 100644 machine/odroid-c2 create mode 100644 machine/odroid-n2 create mode 100644 machine/odroid-xu create mode 100644 machine/qemuarm create mode 100644 machine/qemuarm-64 create mode 100644 machine/qemux86 create mode 100644 machine/qemux86-64 create mode 100644 machine/raspberrypi create mode 100644 machine/raspberrypi2 create mode 100644 machine/raspberrypi3 create mode 100644 machine/raspberrypi3-64 create mode 100644 machine/raspberrypi4 create mode 100644 machine/raspberrypi4-64 create mode 100644 machine/tinker diff --git a/azure-pipelines-release.yml b/azure-pipelines-release.yml index 7bf8e3ddfb2..6bca099d9ad 100644 --- a/azure-pipelines-release.yml +++ b/azure-pipelines-release.yml @@ -115,10 +115,10 @@ stages: docker run --rm --privileged \ -v ~/.docker:/root/.docker \ -v /run/docker.sock:/run/docker.sock:rw \ + -v $(pwd):/data:ro \ homeassistant/amd64-builder:$(versionBuilder) \ --homeassistant-machine "$(homeassistantRelease)=$(buildMachine)" \ - -r https://github.com/home-assistant/hassio-homeassistant \ - -t machine --docker-hub homeassistant + -t /data --docker-hub homeassistant displayName: 'Build Release' - stage: 'Publish' diff --git a/machine/intel-nuc b/machine/intel-nuc new file mode 100644 index 00000000000..4c83228387d --- /dev/null +++ b/machine/intel-nuc @@ -0,0 +1,34 @@ +ARG BUILD_VERSION +FROM homeassistant/amd64-homeassistant:$BUILD_VERSION + +RUN apk --no-cache add \ + libva-intel-driver \ + usbutils + +## +# Build libcec for HDMI-CEC +ARG LIBCEC_VERSION=6.0.2 +RUN apk add --no-cache \ + eudev-libs \ + p8-platform \ + && apk add --no-cache --virtual .build-dependencies \ + build-base \ + cmake \ + eudev-dev \ + swig \ + p8-platform-dev \ + linux-headers \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + && cd /usr/src/libcec \ + && mkdir -p /usr/src/libcec/build \ + && cd /usr/src/libcec/build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.8.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.8" \ + -DHAVE_LINUX_API=1 \ + .. \ + && make -j$(nproc) \ + && make install \ + && echo "cec" > "/usr/local/lib/python3.8/site-packages/cec.pth" \ + && apk del .build-dependencies \ + && rm -rf /usr/src/libcec* diff --git a/machine/odroid-c2 b/machine/odroid-c2 new file mode 100644 index 00000000000..9bfbb931ed0 --- /dev/null +++ b/machine/odroid-c2 @@ -0,0 +1,34 @@ +ARG BUILD_VERSION +FROM homeassistant/aarch64-homeassistant:$BUILD_VERSION + +RUN apk --no-cache add \ + usbutils + +## +# Build libcec for HDMI-CEC +ARG LIBCEC_VERSION=6.0.2 +RUN apk add --no-cache \ + eudev-libs \ + p8-platform \ + && apk add --no-cache --virtual .build-dependencies \ + build-base \ + cmake \ + eudev-dev \ + swig \ + p8-platform-dev \ + linux-headers \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + && cd /usr/src/libcec \ + && mkdir -p /usr/src/libcec/build \ + && cd /usr/src/libcec/build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.8.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.8" \ + -DHAVE_LINUX_API=1 \ + -DHAVE_AOCEC_API=1 \ + .. \ + && make -j$(nproc) \ + && make install \ + && echo "cec" > "/usr/local/lib/python3.8/site-packages/cec.pth" \ + && apk del .build-dependencies \ + && rm -rf /usr/src/libcec* diff --git a/machine/odroid-n2 b/machine/odroid-n2 new file mode 100644 index 00000000000..9bfbb931ed0 --- /dev/null +++ b/machine/odroid-n2 @@ -0,0 +1,34 @@ +ARG BUILD_VERSION +FROM homeassistant/aarch64-homeassistant:$BUILD_VERSION + +RUN apk --no-cache add \ + usbutils + +## +# Build libcec for HDMI-CEC +ARG LIBCEC_VERSION=6.0.2 +RUN apk add --no-cache \ + eudev-libs \ + p8-platform \ + && apk add --no-cache --virtual .build-dependencies \ + build-base \ + cmake \ + eudev-dev \ + swig \ + p8-platform-dev \ + linux-headers \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + && cd /usr/src/libcec \ + && mkdir -p /usr/src/libcec/build \ + && cd /usr/src/libcec/build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.8.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.8" \ + -DHAVE_LINUX_API=1 \ + -DHAVE_AOCEC_API=1 \ + .. \ + && make -j$(nproc) \ + && make install \ + && echo "cec" > "/usr/local/lib/python3.8/site-packages/cec.pth" \ + && apk del .build-dependencies \ + && rm -rf /usr/src/libcec* diff --git a/machine/odroid-xu b/machine/odroid-xu new file mode 100644 index 00000000000..1947115f672 --- /dev/null +++ b/machine/odroid-xu @@ -0,0 +1,34 @@ +ARG BUILD_VERSION +FROM homeassistant/armv7-homeassistant:$BUILD_VERSION + +RUN apk --no-cache add \ + usbutils + +## +# Build libcec for HDMI-CEC +ARG LIBCEC_VERSION=6.0.2 +RUN apk add --no-cache \ + eudev-libs \ + p8-platform \ + && apk add --no-cache --virtual .build-dependencies \ + build-base \ + cmake \ + eudev-dev \ + swig \ + p8-platform-dev \ + linux-headers \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + && cd /usr/src/libcec \ + && mkdir -p /usr/src/libcec/build \ + && cd /usr/src/libcec/build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.8.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.8" \ + -DHAVE_LINUX_API=1 \ + -DHAVE_EXYNOS_API=1 \ + .. \ + && make -j$(nproc) \ + && make install \ + && echo "cec" > "/usr/local/lib/python3.8/site-packages/cec.pth" \ + && apk del .build-dependencies \ + && rm -rf /usr/src/libcec* diff --git a/machine/qemuarm b/machine/qemuarm new file mode 100644 index 00000000000..2735a7bae23 --- /dev/null +++ b/machine/qemuarm @@ -0,0 +1,33 @@ +ARG BUILD_VERSION +FROM homeassistant/armhf-homeassistant:$BUILD_VERSION + +RUN apk --no-cache add \ + usbutils + +## +# Build libcec for HDMI-CEC +ARG LIBCEC_VERSION=6.0.2 +RUN apk add --no-cache \ + eudev-libs \ + p8-platform \ + && apk add --no-cache --virtual .build-dependencies \ + build-base \ + cmake \ + eudev-dev \ + swig \ + p8-platform-dev \ + linux-headers \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + && cd /usr/src/libcec \ + && mkdir -p /usr/src/libcec/build \ + && cd /usr/src/libcec/build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.8.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.8" \ + -DHAVE_LINUX_API=1 \ + .. \ + && make -j$(nproc) \ + && make install \ + && echo "cec" > "/usr/local/lib/python3.8/site-packages/cec.pth" \ + && apk del .build-dependencies \ + && rm -rf /usr/src/libcec* diff --git a/machine/qemuarm-64 b/machine/qemuarm-64 new file mode 100644 index 00000000000..5783de82f58 --- /dev/null +++ b/machine/qemuarm-64 @@ -0,0 +1,33 @@ +ARG BUILD_VERSION +FROM homeassistant/aarch64-homeassistant:$BUILD_VERSION + +RUN apk --no-cache add \ + usbutils + +## +# Build libcec for HDMI-CEC +ARG LIBCEC_VERSION=6.0.2 +RUN apk add --no-cache \ + eudev-libs \ + p8-platform \ + && apk add --no-cache --virtual .build-dependencies \ + build-base \ + cmake \ + eudev-dev \ + swig \ + p8-platform-dev \ + linux-headers \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + && cd /usr/src/libcec \ + && mkdir -p /usr/src/libcec/build \ + && cd /usr/src/libcec/build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.8.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.8" \ + -DHAVE_LINUX_API=1 \ + .. \ + && make -j$(nproc) \ + && make install \ + && echo "cec" > "/usr/local/lib/python3.8/site-packages/cec.pth" \ + && apk del .build-dependencies \ + && rm -rf /usr/src/libcec* diff --git a/machine/qemux86 b/machine/qemux86 new file mode 100644 index 00000000000..192d287dfde --- /dev/null +++ b/machine/qemux86 @@ -0,0 +1,33 @@ +ARG BUILD_VERSION +FROM homeassistant/i386-homeassistant:$BUILD_VERSION + +RUN apk --no-cache add \ + usbutils + +## +# Build libcec for HDMI-CEC +ARG LIBCEC_VERSION=6.0.2 +RUN apk add --no-cache \ + eudev-libs \ + p8-platform \ + && apk add --no-cache --virtual .build-dependencies \ + build-base \ + cmake \ + eudev-dev \ + swig \ + p8-platform-dev \ + linux-headers \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + && cd /usr/src/libcec \ + && mkdir -p /usr/src/libcec/build \ + && cd /usr/src/libcec/build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.8.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.8" \ + -DHAVE_LINUX_API=1 \ + .. \ + && make -j$(nproc) \ + && make install \ + && echo "cec" > "/usr/local/lib/python3.8/site-packages/cec.pth" \ + && apk del .build-dependencies \ + && rm -rf /usr/src/libcec* diff --git a/machine/qemux86-64 b/machine/qemux86-64 new file mode 100644 index 00000000000..5f4ca461ae8 --- /dev/null +++ b/machine/qemux86-64 @@ -0,0 +1,33 @@ +ARG BUILD_VERSION +FROM homeassistant/amd64-homeassistant:$BUILD_VERSION + +RUN apk --no-cache add \ + usbutils + +## +# Build libcec for HDMI-CEC +ARG LIBCEC_VERSION=6.0.2 +RUN apk add --no-cache \ + eudev-libs \ + p8-platform \ + && apk add --no-cache --virtual .build-dependencies \ + build-base \ + cmake \ + eudev-dev \ + swig \ + p8-platform-dev \ + linux-headers \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + && cd /usr/src/libcec \ + && mkdir -p /usr/src/libcec/build \ + && cd /usr/src/libcec/build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.8.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.8" \ + -DHAVE_LINUX_API=1 \ + .. \ + && make -j$(nproc) \ + && make install \ + && echo "cec" > "/usr/local/lib/python3.8/site-packages/cec.pth" \ + && apk del .build-dependencies \ + && rm -rf /usr/src/libcec* diff --git a/machine/raspberrypi b/machine/raspberrypi new file mode 100644 index 00000000000..d7add9bf63f --- /dev/null +++ b/machine/raspberrypi @@ -0,0 +1,61 @@ +ARG BUILD_VERSION +FROM homeassistant/armhf-homeassistant:$BUILD_VERSION + +RUN apk --no-cache add \ + raspberrypi \ + raspberrypi-libs \ + usbutils \ + && sed -i "s|# RPi.GPIO|RPi.GPIO|g" /usr/src/homeassistant/requirements_all.txt \ + && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ + RPi.GPIO -c /usr/src/homeassistant/requirements_all.txt + +## +# Set symlinks for raspberry pi camera binaries. +RUN ln -sv /opt/vc/bin/raspistill /usr/local/bin/raspistill \ + && ln -sv /opt/vc/bin/raspivid /usr/local/bin/raspivid \ + && ln -sv /opt/vc/bin/raspividyuv /usr/local/bin/raspividyuv \ + && ln -sv /opt/vc/bin/raspiyuv /usr/local/bin/raspiyuv + +## +# Build libcec with RPi support for HDMI-CEC +ARG LIBCEC_VERSION=6.0.2 +RUN apk add --no-cache \ + eudev-libs \ + p8-platform \ + && apk add --no-cache --virtual .build-dependencies \ + build-base \ + cmake \ + eudev-dev \ + swig \ + raspberrypi-dev \ + p8-platform-dev \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + && mkdir -p /usr/src/libcec/build \ + && cd /usr/src/libcec/build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + -DRPI_INCLUDE_DIR=/opt/vc/include \ + -DRPI_LIB_DIR=/opt/vc/lib \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.8.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.8" \ + .. \ + && make -j$(nproc) \ + && make install \ + && echo "cec" > "/usr/local/lib/python3.8/site-packages/cec.pth" \ + && apk del .build-dependencies \ + && rm -rf /usr/src/libcec +ENV LD_LIBRARY_PATH=/opt/vc/lib:${LD_LIBRARY_PATH} + +## +# Install DHT +RUN apk add --no-cache --virtual .build-dependencies \ + gcc libc-dev raspberrypi-dev \ + && export DHT_VERSION="$(cat /usr/src/homeassistant/requirements_all.txt | sed -n 's|.*Adafruit-DHT==\([0-9\.]*\).*|\1|p')" \ + && git clone --depth 1 -b ${DHT_VERSION} https://github.com/adafruit/Adafruit_Python_DHT /usr/src/dht \ + && cd /usr/src/dht \ + && sed -i 's/^pi_version\ =\ None/pi_version\ =\ 1/' setup.py \ + && sed -i 's/^platform\ =\ platform_detect.UNKNOWN/platform\ =\ platform_detect.RASPBERRY_PI/' setup.py \ + && sed -i 's/platform\ =\ platform_detect.platform_detect()/pass/' setup.py \ + && export MAKEFLAGS="-j$(nproc)" \ + && pip3 install . \ + && apk del .build-dependencies \ + && rm -rf /usr/src/dht diff --git a/machine/raspberrypi2 b/machine/raspberrypi2 new file mode 100644 index 00000000000..2643af911a4 --- /dev/null +++ b/machine/raspberrypi2 @@ -0,0 +1,61 @@ +ARG BUILD_VERSION +FROM homeassistant/armv7-homeassistant:$BUILD_VERSION + +RUN apk --no-cache add \ + raspberrypi \ + raspberrypi-libs \ + usbutils \ + && sed -i "s|# RPi.GPIO|RPi.GPIO|g" /usr/src/homeassistant/requirements_all.txt \ + && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ + RPi.GPIO -c /usr/src/homeassistant/requirements_all.txt + +## +# Set symlinks for raspberry pi binaries. +RUN ln -sv /opt/vc/bin/raspistill /usr/local/bin/raspistill \ + && ln -sv /opt/vc/bin/raspivid /usr/local/bin/raspivid \ + && ln -sv /opt/vc/bin/raspividyuv /usr/local/bin/raspividyuv \ + && ln -sv /opt/vc/bin/raspiyuv /usr/local/bin/raspiyuv + +## +# Build libcec with RPi support for HDMI-CEC +ARG LIBCEC_VERSION=6.0.2 +RUN apk add --no-cache \ + eudev-libs \ + p8-platform \ + && apk add --no-cache --virtual .build-dependencies \ + build-base \ + cmake \ + eudev-dev \ + swig \ + raspberrypi-dev \ + p8-platform-dev \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + && mkdir -p /usr/src/libcec/build \ + && cd /usr/src/libcec/build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + -DRPI_INCLUDE_DIR=/opt/vc/include \ + -DRPI_LIB_DIR=/opt/vc/lib \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.8.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.8" \ + .. \ + && make -j$(nproc) \ + && make install \ + && echo "cec" > "/usr/local/lib/python3.8/site-packages/cec.pth" \ + && apk del .build-dependencies \ + && rm -rf /usr/src/libcec +ENV LD_LIBRARY_PATH=/opt/vc/lib:${LD_LIBRARY_PATH} + +## +# Install DHT +RUN apk add --no-cache --virtual .build-dependencies \ + gcc libc-dev raspberrypi-dev \ + && export DHT_VERSION="$(cat /usr/src/homeassistant/requirements_all.txt | sed -n 's|.*Adafruit-DHT==\([0-9\.]*\).*|\1|p')" \ + && git clone --depth 1 -b ${DHT_VERSION} https://github.com/adafruit/Adafruit_Python_DHT /usr/src/dht \ + && cd /usr/src/dht \ + && sed -i 's/^pi_version\ =\ None/pi_version\ =\ 2/' setup.py \ + && sed -i 's/^platform\ =\ platform_detect.UNKNOWN/platform\ =\ platform_detect.RASPBERRY_PI/' setup.py \ + && sed -i 's/platform\ =\ platform_detect.platform_detect()/pass/' setup.py \ + && export MAKEFLAGS="-j$(nproc)" \ + && pip3 install . \ + && apk del .build-dependencies \ + && rm -rf /usr/src/dht diff --git a/machine/raspberrypi3 b/machine/raspberrypi3 new file mode 100644 index 00000000000..5aed2308ef6 --- /dev/null +++ b/machine/raspberrypi3 @@ -0,0 +1,61 @@ +ARG BUILD_VERSION +FROM homeassistant/armv7-homeassistant:$BUILD_VERSION + +RUN apk --no-cache add \ + raspberrypi \ + raspberrypi-libs \ + usbutils \ + && sed -i "s|# RPi.GPIO|RPi.GPIO|g" /usr/src/homeassistant/requirements_all.txt \ + && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ + RPi.GPIO bluepy pybluez -c /usr/src/homeassistant/requirements_all.txt + +## +# Set symlinks for raspberry pi binaries. +RUN ln -sv /opt/vc/bin/raspistill /usr/local/bin/raspistill \ + && ln -sv /opt/vc/bin/raspivid /usr/local/bin/raspivid \ + && ln -sv /opt/vc/bin/raspividyuv /usr/local/bin/raspividyuv \ + && ln -sv /opt/vc/bin/raspiyuv /usr/local/bin/raspiyuv + +## +# Build libcec with RPi support for HDMI-CEC +ARG LIBCEC_VERSION=6.0.2 +RUN apk add --no-cache \ + eudev-libs \ + p8-platform \ + && apk add --no-cache --virtual .build-dependencies \ + build-base \ + cmake \ + eudev-dev \ + swig \ + raspberrypi-dev \ + p8-platform-dev \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + && mkdir -p /usr/src/libcec/build \ + && cd /usr/src/libcec/build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + -DRPI_INCLUDE_DIR=/opt/vc/include \ + -DRPI_LIB_DIR=/opt/vc/lib \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.8.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.8" \ + .. \ + && make -j$(nproc) \ + && make install \ + && echo "cec" > "/usr/local/lib/python3.8/site-packages/cec.pth" \ + && apk del .build-dependencies \ + && rm -rf /usr/src/libcec +ENV LD_LIBRARY_PATH=/opt/vc/lib:${LD_LIBRARY_PATH} + +## +# Install DHT +RUN apk add --no-cache --virtual .build-dependencies \ + gcc libc-dev raspberrypi-dev \ + && export DHT_VERSION="$(cat /usr/src/homeassistant/requirements_all.txt | sed -n 's|.*Adafruit-DHT==\([0-9\.]*\).*|\1|p')" \ + && git clone --depth 1 -b ${DHT_VERSION} https://github.com/adafruit/Adafruit_Python_DHT /usr/src/dht \ + && cd /usr/src/dht \ + && sed -i 's/^pi_version\ =\ None/pi_version\ =\ 3/' setup.py \ + && sed -i 's/^platform\ =\ platform_detect.UNKNOWN/platform\ =\ platform_detect.RASPBERRY_PI/' setup.py \ + && sed -i 's/platform\ =\ platform_detect.platform_detect()/pass/' setup.py \ + && export MAKEFLAGS="-j$(nproc)" \ + && pip3 install . \ + && apk del .build-dependencies \ + && rm -rf /usr/src/dht diff --git a/machine/raspberrypi3-64 b/machine/raspberrypi3-64 new file mode 100644 index 00000000000..1b31726c879 --- /dev/null +++ b/machine/raspberrypi3-64 @@ -0,0 +1,61 @@ +ARG BUILD_VERSION +FROM homeassistant/aarch64-homeassistant:$BUILD_VERSION + +RUN apk --no-cache add \ + raspberrypi \ + raspberrypi-libs \ + usbutils \ + && sed -i "s|# RPi.GPIO|RPi.GPIO|g" /usr/src/homeassistant/requirements_all.txt \ + && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ + RPi.GPIO bluepy pybluez -c /usr/src/homeassistant/requirements_all.txt + +## +# Set symlinks for raspberry pi binaries. +RUN ln -sv /opt/vc/bin/raspistill /usr/local/bin/raspistill \ + && ln -sv /opt/vc/bin/raspivid /usr/local/bin/raspivid \ + && ln -sv /opt/vc/bin/raspividyuv /usr/local/bin/raspividyuv \ + && ln -sv /opt/vc/bin/raspiyuv /usr/local/bin/raspiyuv + +## +# Build libcec with RPi support for HDMI-CEC +ARG LIBCEC_VERSION=6.0.2 +RUN apk add --no-cache \ + eudev-libs \ + p8-platform \ + && apk add --no-cache --virtual .build-dependencies \ + build-base \ + cmake \ + eudev-dev \ + swig \ + raspberrypi-dev \ + p8-platform-dev \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + && mkdir -p /usr/src/libcec/build \ + && cd /usr/src/libcec/build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + -DRPI_INCLUDE_DIR=/opt/vc/include \ + -DRPI_LIB_DIR=/opt/vc/lib \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.8.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.8" \ + .. \ + && make -j$(nproc) \ + && make install \ + && echo "cec" > "/usr/local/lib/python3.8/site-packages/cec.pth" \ + && apk del .build-dependencies \ + && rm -rf /usr/src/libcec +ENV LD_LIBRARY_PATH=/opt/vc/lib:${LD_LIBRARY_PATH} + +## +# Install DHT +RUN apk add --no-cache --virtual .build-dependencies \ + gcc libc-dev raspberrypi-dev \ + && export DHT_VERSION="$(cat /usr/src/homeassistant/requirements_all.txt | sed -n 's|.*Adafruit-DHT==\([0-9\.]*\).*|\1|p')" \ + && git clone --depth 1 -b ${DHT_VERSION} https://github.com/adafruit/Adafruit_Python_DHT /usr/src/dht \ + && cd /usr/src/dht \ + && sed -i 's/^pi_version\ =\ None/pi_version\ =\ 3/' setup.py \ + && sed -i 's/^platform\ =\ platform_detect.UNKNOWN/platform\ =\ platform_detect.RASPBERRY_PI/' setup.py \ + && sed -i 's/platform\ =\ platform_detect.platform_detect()/pass/' setup.py \ + && export MAKEFLAGS="-j$(nproc)" \ + && pip3 install . \ + && apk del .build-dependencies \ + && rm -rf /usr/src/dht diff --git a/machine/raspberrypi4 b/machine/raspberrypi4 new file mode 100644 index 00000000000..5aed2308ef6 --- /dev/null +++ b/machine/raspberrypi4 @@ -0,0 +1,61 @@ +ARG BUILD_VERSION +FROM homeassistant/armv7-homeassistant:$BUILD_VERSION + +RUN apk --no-cache add \ + raspberrypi \ + raspberrypi-libs \ + usbutils \ + && sed -i "s|# RPi.GPIO|RPi.GPIO|g" /usr/src/homeassistant/requirements_all.txt \ + && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ + RPi.GPIO bluepy pybluez -c /usr/src/homeassistant/requirements_all.txt + +## +# Set symlinks for raspberry pi binaries. +RUN ln -sv /opt/vc/bin/raspistill /usr/local/bin/raspistill \ + && ln -sv /opt/vc/bin/raspivid /usr/local/bin/raspivid \ + && ln -sv /opt/vc/bin/raspividyuv /usr/local/bin/raspividyuv \ + && ln -sv /opt/vc/bin/raspiyuv /usr/local/bin/raspiyuv + +## +# Build libcec with RPi support for HDMI-CEC +ARG LIBCEC_VERSION=6.0.2 +RUN apk add --no-cache \ + eudev-libs \ + p8-platform \ + && apk add --no-cache --virtual .build-dependencies \ + build-base \ + cmake \ + eudev-dev \ + swig \ + raspberrypi-dev \ + p8-platform-dev \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + && mkdir -p /usr/src/libcec/build \ + && cd /usr/src/libcec/build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + -DRPI_INCLUDE_DIR=/opt/vc/include \ + -DRPI_LIB_DIR=/opt/vc/lib \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.8.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.8" \ + .. \ + && make -j$(nproc) \ + && make install \ + && echo "cec" > "/usr/local/lib/python3.8/site-packages/cec.pth" \ + && apk del .build-dependencies \ + && rm -rf /usr/src/libcec +ENV LD_LIBRARY_PATH=/opt/vc/lib:${LD_LIBRARY_PATH} + +## +# Install DHT +RUN apk add --no-cache --virtual .build-dependencies \ + gcc libc-dev raspberrypi-dev \ + && export DHT_VERSION="$(cat /usr/src/homeassistant/requirements_all.txt | sed -n 's|.*Adafruit-DHT==\([0-9\.]*\).*|\1|p')" \ + && git clone --depth 1 -b ${DHT_VERSION} https://github.com/adafruit/Adafruit_Python_DHT /usr/src/dht \ + && cd /usr/src/dht \ + && sed -i 's/^pi_version\ =\ None/pi_version\ =\ 3/' setup.py \ + && sed -i 's/^platform\ =\ platform_detect.UNKNOWN/platform\ =\ platform_detect.RASPBERRY_PI/' setup.py \ + && sed -i 's/platform\ =\ platform_detect.platform_detect()/pass/' setup.py \ + && export MAKEFLAGS="-j$(nproc)" \ + && pip3 install . \ + && apk del .build-dependencies \ + && rm -rf /usr/src/dht diff --git a/machine/raspberrypi4-64 b/machine/raspberrypi4-64 new file mode 100644 index 00000000000..1b31726c879 --- /dev/null +++ b/machine/raspberrypi4-64 @@ -0,0 +1,61 @@ +ARG BUILD_VERSION +FROM homeassistant/aarch64-homeassistant:$BUILD_VERSION + +RUN apk --no-cache add \ + raspberrypi \ + raspberrypi-libs \ + usbutils \ + && sed -i "s|# RPi.GPIO|RPi.GPIO|g" /usr/src/homeassistant/requirements_all.txt \ + && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ + RPi.GPIO bluepy pybluez -c /usr/src/homeassistant/requirements_all.txt + +## +# Set symlinks for raspberry pi binaries. +RUN ln -sv /opt/vc/bin/raspistill /usr/local/bin/raspistill \ + && ln -sv /opt/vc/bin/raspivid /usr/local/bin/raspivid \ + && ln -sv /opt/vc/bin/raspividyuv /usr/local/bin/raspividyuv \ + && ln -sv /opt/vc/bin/raspiyuv /usr/local/bin/raspiyuv + +## +# Build libcec with RPi support for HDMI-CEC +ARG LIBCEC_VERSION=6.0.2 +RUN apk add --no-cache \ + eudev-libs \ + p8-platform \ + && apk add --no-cache --virtual .build-dependencies \ + build-base \ + cmake \ + eudev-dev \ + swig \ + raspberrypi-dev \ + p8-platform-dev \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + && mkdir -p /usr/src/libcec/build \ + && cd /usr/src/libcec/build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + -DRPI_INCLUDE_DIR=/opt/vc/include \ + -DRPI_LIB_DIR=/opt/vc/lib \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.8.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.8" \ + .. \ + && make -j$(nproc) \ + && make install \ + && echo "cec" > "/usr/local/lib/python3.8/site-packages/cec.pth" \ + && apk del .build-dependencies \ + && rm -rf /usr/src/libcec +ENV LD_LIBRARY_PATH=/opt/vc/lib:${LD_LIBRARY_PATH} + +## +# Install DHT +RUN apk add --no-cache --virtual .build-dependencies \ + gcc libc-dev raspberrypi-dev \ + && export DHT_VERSION="$(cat /usr/src/homeassistant/requirements_all.txt | sed -n 's|.*Adafruit-DHT==\([0-9\.]*\).*|\1|p')" \ + && git clone --depth 1 -b ${DHT_VERSION} https://github.com/adafruit/Adafruit_Python_DHT /usr/src/dht \ + && cd /usr/src/dht \ + && sed -i 's/^pi_version\ =\ None/pi_version\ =\ 3/' setup.py \ + && sed -i 's/^platform\ =\ platform_detect.UNKNOWN/platform\ =\ platform_detect.RASPBERRY_PI/' setup.py \ + && sed -i 's/platform\ =\ platform_detect.platform_detect()/pass/' setup.py \ + && export MAKEFLAGS="-j$(nproc)" \ + && pip3 install . \ + && apk del .build-dependencies \ + && rm -rf /usr/src/dht diff --git a/machine/tinker b/machine/tinker new file mode 100644 index 00000000000..46b627c2257 --- /dev/null +++ b/machine/tinker @@ -0,0 +1,48 @@ +ARG BUILD_VERSION +FROM homeassistant/armv7-homeassistant:$BUILD_VERSION + +RUN apk --no-cache add usbutils \ + && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ + -c /usr/src/homeassistant/homeassistant/package_constraints.txt \ + bluepy \ + pybluez \ + pygatt[GATTTOOL] + +# Install GPIO support +RUN apk add --no-cache --virtual .build-dependencies \ + gcc libc-dev musl-dev \ + && git clone --depth 1 https://github.com/TinkerBoard/gpio_lib_python /usr/src/gpio \ + && cd /usr/src/gpio \ + && sed -i "s/caddr_t/void*/g" source/wiringTB.c \ + && export MAKEFLAGS="-j$(nproc)" \ + && python3 setup.py install \ + && apk del .build-dependencies \ + && rm -rf /usr/src/gpio + +## +# Build libcec for HDMI-CEC +ARG LIBCEC_VERSION=6.0.2 +RUN apk add --no-cache \ + eudev-libs \ + p8-platform \ + && apk add --no-cache --virtual .build-dependencies \ + build-base \ + cmake \ + eudev-dev \ + swig \ + p8-platform-dev \ + linux-headers \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + && cd /usr/src/libcec \ + && mkdir -p /usr/src/libcec/build \ + && cd /usr/src/libcec/build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.8.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.8" \ + -DHAVE_LINUX_API=1 \ + .. \ + && make -j$(nproc) \ + && make install \ + && echo "cec" > "/usr/local/lib/python3.8/site-packages/cec.pth" \ + && apk del .build-dependencies \ + && rm -rf /usr/src/libcec*