mirror of
https://github.com/esphome/esphome.git
synced 2024-11-12 18:27:46 +01:00
Install s6, tempio and bashio for ha-addon image
Install cryptography manually in armv7 image
This commit is contained in:
parent
3e1d031d77
commit
b012d56cc2
1 changed files with 73 additions and 8 deletions
|
@ -1,9 +1,28 @@
|
|||
ARG BUILD_VERSION=dev
|
||||
ARG BUILD_TYPE=docker
|
||||
|
||||
FROM ghcr.io/esphome/docker-base:2024.9.0 AS base
|
||||
|
||||
RUN git config --system --add safe.directory "*"
|
||||
|
||||
COPY requirements.txt /
|
||||
|
||||
FROM base AS base-amd64
|
||||
FROM base AS base-arm64
|
||||
FROM base AS base-armv7
|
||||
|
||||
RUN \
|
||||
export cryptography_version=$(grep 'cryptography==' /requirements.txt | cut -d'=' -f3) \
|
||||
&& curl -L https://www.piwheels.org/cp311/cryptography-$cryptography_version-cp37-abi3-linux_armv7l.whl -o /tmp/cryptography-$cryptography_version-cp37-abi3-linux_armv7l.whl \
|
||||
&& uv pip install --no-cache-dir /tmp/cryptography-$cryptography_version-cp37-abi3-linux_armv7l.whl \
|
||||
&& rm /tmp/cryptography-$cryptography_version-cp37-abi3-linux_armv7l.whl
|
||||
|
||||
|
||||
ARG TARGETARCH
|
||||
ARG TARGETVARIANT
|
||||
|
||||
FROM base-${TARGETARCH}${TARGETVARIANT} AS base-final
|
||||
|
||||
RUN \
|
||||
uv pip install --no-cache-dir \
|
||||
-r /requirements.txt
|
||||
|
@ -18,9 +37,8 @@ COPY script/platformio_install_deps.py platformio.ini /
|
|||
|
||||
RUN /platformio_install_deps.py /platformio.ini --libraries
|
||||
|
||||
FROM base AS base-docker
|
||||
FROM base-final AS base-docker
|
||||
|
||||
ENV USERNAME="" PASSWORD=""
|
||||
EXPOSE 6052
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=30s \
|
||||
|
@ -33,25 +51,73 @@ WORKDIR /config
|
|||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["dashboard", "/config"]
|
||||
|
||||
FROM base AS base-hassio
|
||||
FROM base-final AS base-hassio
|
||||
|
||||
# TODO: Install s6-overlay
|
||||
ARG \
|
||||
BASHIO_VERSION=0.16.2 \
|
||||
TEMPIO_VERSION=2021.09.0 \
|
||||
S6_OVERLAY_VERSION=3.2.0.0
|
||||
|
||||
WORKDIR /usr/src
|
||||
|
||||
ARG TARGETARCH
|
||||
ARG TARGETVARIANT
|
||||
|
||||
RUN \
|
||||
set -x \
|
||||
&& if [ "${TARGETARCH}${TARGETVARIANT}" = "armv7" ]; then \
|
||||
export S6_ARCH="arm"; \
|
||||
export TEMPIO_ARCH="armv7"; \
|
||||
elif [ "${TARGETARCH}${TARGETVARIANT}" = "amd64" ]; then \
|
||||
export S6_ARCH="x86_64"; \
|
||||
export TEMPIO_ARCH="amd64"; \
|
||||
elif [ "${TARGETARCH}${TARGETVARIANT}" = "arm64"]; then \
|
||||
export S6_ARCH="aarch64"; \
|
||||
export TEMPIO_ARCH="aarch64"; \
|
||||
fi \
|
||||
\
|
||||
&& curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz" \
|
||||
| tar Jxvf - -C / \
|
||||
&& curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" \
|
||||
| tar Jxvf - -C / \
|
||||
&& curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz" \
|
||||
| tar Jxvf - -C / \
|
||||
&& curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz" \
|
||||
| tar Jxvf - -C / \
|
||||
&& mkdir -p /etc/fix-attrs.d \
|
||||
&& mkdir -p /etc/services.d \
|
||||
\
|
||||
&& curl -L -f -s -o /usr/bin/tempio \
|
||||
"https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${TEMPIO_ARCH}" \
|
||||
&& chmod a+x /usr/bin/tempio \
|
||||
\
|
||||
&& mkdir -p /usr/src/bashio \
|
||||
&& curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" \
|
||||
| tar -xzf - --strip 1 -C /usr/src/bashio \
|
||||
&& mv /usr/src/bashio/lib /usr/lib/bashio \
|
||||
&& ln -s /usr/lib/bashio/bashio /usr/bin/bashio \
|
||||
\
|
||||
&& rm -rf /usr/src/*
|
||||
|
||||
RUN \
|
||||
set -x \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
nginx-light=1.22.1-9 \
|
||||
jq \
|
||||
&& rm -rf \
|
||||
/tmp/* \
|
||||
/var/{cache,log}/* \
|
||||
/var/lib/apt/lists/* \
|
||||
/usr/src/*
|
||||
|
||||
ARG BUILD_VERSION=dev
|
||||
|
||||
COPY docker/ha-addon-rootfs/ /
|
||||
|
||||
WORKDIR /root
|
||||
ENTRYPOINT ["/init"]
|
||||
|
||||
ARG BUILD_VERSION
|
||||
LABEL \
|
||||
io.hass.name="ESPHome" \
|
||||
io.hass.description="Manage and program microcontrollers through YAML configuration files" \
|
||||
|
@ -59,8 +125,7 @@ LABEL \
|
|||
io.hass.version="${BUILD_VERSION}"
|
||||
|
||||
|
||||
ARG BUILD_TYPE=docker
|
||||
|
||||
ARG BUILD_TYPE
|
||||
FROM base-${BUILD_TYPE} AS final
|
||||
|
||||
COPY . /esphome
|
||||
|
@ -68,6 +133,6 @@ COPY . /esphome
|
|||
RUN uv pip install --no-cache-dir -e /esphome
|
||||
|
||||
|
||||
FROM base AS lint
|
||||
FROM base-final AS lint
|
||||
|
||||
# TODO:
|
||||
|
|
Loading…
Reference in a new issue