wheelie/Dockerfile.homeassistant
2023-04-04 14:42:25 -04:00

108 lines
3.1 KiB
Docker

ARG ARCH=amd64
FROM ghcr.io/linuxserver/baseimage-alpine:${ARCH}-3.16
ARG ARCH=amd64
ARG GRPC_BUILD_WITH_BORING_SSL_ASM=false
ARG GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=true
ARG GRPC_PYTHON_BUILD_WITH_CYTHON=true
ARG GRPC_PYTHON_DISABLE_LIBC_COMPATIBILITY=true
# environment settings
ENV PIPFLAGS="--no-cache-dir --use-deprecated=legacy-resolver --find-links https://wheel-index.linuxserver.io/alpine-3.16/ --find-links https://wheel-index.linuxserver.io/homeassistant-3.16/"
# install packages
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
autoconf \
ca-certificates \
cargo \
cmake \
cups-dev \
eudev-dev \
ffmpeg-dev \
gcc \
glib-dev \
g++ \
jq \
libffi-dev \
jpeg-dev \
libxml2-dev \
libxslt-dev \
make \
postgresql-dev \
python3-dev \
unixodbc-dev \
unzip && \
echo "**** install runtime packages ****" && \
apk add --no-cache --virtual=runtime-dependencies \
bluez \
bluez-deprecated \
bluez-libs \
cups-libs \
curl \
eudev-libs \
ffmpeg \
iputils \
libcap \
libjpeg-turbo \
libstdc++ \
libxslt \
mariadb-connector-c \
mariadb-connector-c-dev \
openssh-client \
openssl \
postgresql-libs \
py3-pip \
python3 \
tiff && \
echo "**** retrieve homeassistant ****" && \
mkdir -p \
/tmp/core && \
export HASS_RELEASE=$(curl -sX GET https://api.github.com/repos/home-assistant/core/releases/latest \
| jq -r .tag_name) && \
curl -o \
/tmp/core.tar.gz -L \
"https://github.com/home-assistant/core/archive/${HASS_RELEASE}.tar.gz" && \
tar xf \
/tmp/core.tar.gz -C \
/tmp/core --strip-components=1 && \
export HASS_BASE=$(cat /tmp/core/build.yaml \
| grep 'amd64: ' \
| cut -d: -f3) && \
echo "**** Updating pip and building wheels ****" && \
pip3 install -U "pip>=21.0,<22.1" setuptools wheel cython && \
mkdir -p /build && \
cd /tmp/core && \
NUMPY_VER=$(grep "numpy" requirements_all.txt) && \
pip wheel --wheel-dir=/build ${PIPFLAGS} \
"${NUMPY_VER}" && \
pip install /build/numpy*.whl && \
if [ "${ARCH}" = "arm32v7" ]; then \
pip install ${PIPFLAGS} --only-binary cmake cmake; \
fi && \
pip wheel --wheel-dir=/build ${PIPFLAGS} --only-binary cmake \
-r https://raw.githubusercontent.com/home-assistant/docker/${HASS_BASE}/requirements.txt && \
pip wheel --wheel-dir=/build ${PIPFLAGS} --only-binary cmake \
-r requirements_all.txt && \
pip wheel --wheel-dir=/build ${PIPFLAGS} --only-binary cmake \
homeassistant==${HASS_RELEASE} && \
pip wheel --wheel-dir=/build ${PIPFLAGS} --only-binary cmake \
pycups && \
echo "**** cleanup ****" && \
apk del --purge \
build-dependencies \
runtime-dependencies && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/* \
${HOME}/.cargo \
${HOME}/.cache && \
echo "**** Renaming wheels if necessary ****" && \
/bin/bash -c 'for i in $(ls /build/*armv7l*.whl 2>/dev/null); do echo "processing ${i}" && cp -- "$i" "${i//armv7l/armv8l}"; done' && \
echo "**** Wheels built are: ****" && \
ls /build