From 8587e7ad74a70df9ad5b09b367a6f904e1d3dc7d Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Sat, 24 Nov 2018 17:33:52 +0100 Subject: [PATCH] Update esphomeyaml-edge --- .gitlab-ci.yml | 15 +++---- docker/Dockerfile.hassio | 90 ++++++++++++++++++++++++++----------- docker/platformio.ini | 12 ----- esphomeyaml-edge/Dockerfile | 15 +++---- esphomeyaml-edge/README.md | 15 ++----- 5 files changed, 77 insertions(+), 70 deletions(-) delete mode 100644 docker/platformio.ini diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 222d534cf6..0b2b94f43d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -62,21 +62,20 @@ test2: stage: build script: - docker run --rm --privileged hassioaddons/qemu-user-static:latest - - BUILD_FROM=homeassistant/${ADDON_ARCH}-base-ubuntu:latest + - BUILD_FROM=hassioaddons/ubuntu-base-${BUILD_ARCH}:2.2.0 - ADDON_VERSION="${CI_COMMIT_TAG#v}" - ADDON_VERSION="${ADDON_VERSION:-${CI_COMMIT_SHA:0:7}}" - - ESPHOMELIB_VERSION="${ESPHOMELIB_VERSION:-''}" - echo "Build from ${BUILD_FROM}" - echo "Add-on version ${ADDON_VERSION}" - - echo "Esphomelib version ${ESPHOMELIB_VERSION}" - echo "Tag ${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:dev" - echo "Tag ${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" - | docker build \ --build-arg "BUILD_FROM=${BUILD_FROM}" \ - --build-arg "ADDON_ARCH=${ADDON_ARCH}" \ - --build-arg "ADDON_VERSION=${ADDON_VERSION}" \ - --build-arg "ESPHOMELIB_VERSION=${ESPHOMELIB_VERSION}" \ + --build-arg "BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ")" \ + --build-arg "BUILD_ARCH=${ADDON_ARCH}" \ + --build-arg "BUILD_REF=${CI_COMMIT_SHA}" \ + --build-arg "BUILD_VERSION=${ADDON_VERSION}" \ --tag "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:dev" \ --tag "${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ --file "docker/Dockerfile.hassio" \ @@ -209,7 +208,6 @@ build:hassio-armhf-edge: variables: ADDON_ARCH: armhf DO_PUSH: "false" - ESPHOMELIB_VERSION: "${CI_COMMIT_TAG}" build:hassio-armhf: <<: *build-hassio-release @@ -221,7 +219,6 @@ build:hassio-aarch64-edge: variables: ADDON_ARCH: aarch64 DO_PUSH: "false" - ESPHOMELIB_VERSION: "${CI_COMMIT_TAG}" build:hassio-aarch64: <<: *build-hassio-release @@ -233,7 +230,6 @@ build:hassio-i386-edge: variables: ADDON_ARCH: i386 DO_PUSH: "false" - ESPHOMELIB_VERSION: "${CI_COMMIT_TAG}" build:hassio-i386: <<: *build-hassio-release @@ -245,7 +241,6 @@ build:hassio-amd64-edge: variables: ADDON_ARCH: amd64 DO_PUSH: "false" - ESPHOMELIB_VERSION: "${CI_COMMIT_TAG}" build:hassio-amd64: <<: *build-hassio-release diff --git a/docker/Dockerfile.hassio b/docker/Dockerfile.hassio index 7c1adacd90..45769710b8 100644 --- a/docker/Dockerfile.hassio +++ b/docker/Dockerfile.hassio @@ -1,40 +1,78 @@ -# Dockerfile for HassIO add-on -ARG BUILD_FROM=homeassistant/amd64-base-ubuntu:latest +ARG BUILD_FROM=hassioaddons/ubuntu-base:2.2.0 +# hadolint ignore=DL3006 FROM ${BUILD_FROM} -RUN apt-get update && apt-get install -y --no-install-recommends \ +# Set shell +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# Copy root filesystem +COPY esphomeyaml-edge/rootfs / +COPY setup.py setup.cfg MANIFEST.in /opt/esphomeyaml/ +COPY esphomeyaml /opt/esphomeyaml/esphomeyaml + +RUN \ + # Temporarily move nginx.conf (otherwise dpkg fails) + mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bkp \ + # Install add-on dependencies + && apt-get update \ + && apt-get install -y --no-install-recommends \ + # Python for esphomeyaml python \ python-pip \ python-setuptools \ + # Python Pillow for display component python-pil \ + # Git for esphomelib downloads git \ - && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* && \ - pip install --no-cache-dir --no-binary :all: platformio && \ - platformio settings set enable_telemetry No && \ - platformio settings set check_libraries_interval 1000000 && \ - platformio settings set check_platformio_interval 1000000 && \ - platformio settings set check_platforms_interval 1000000 - -COPY docker/platformio.ini /pio/platformio.ini -RUN platformio run -d /pio; rm -rf /pio - - -COPY . . -RUN pip install --no-cache-dir --no-binary :all: -e . && \ - pip install --no-cache-dir --no-binary :all: tzlocal - -CMD ["esphomeyaml", "/config/esphomeyaml", "dashboard"] + # Ping for dashboard online/offline status + iputils-ping \ + # NGINX proxy + nginx \ + \ + && mv /etc/nginx/nginx.conf.bkp /etc/nginx/nginx.conf \ + \ + && pip2 install --no-cache-dir --no-binary :all: -e /opt/esphomeyaml \ + \ + # tzlocal for automatic timezone detection + && pip2 install --no-cache-dir --no-binary :all: tzlocal \ + \ + # Change some platformio settings + && platformio settings set enable_telemetry No \ + && platformio settings set check_libraries_interval 1000000 \ + && platformio settings set check_platformio_interval 1000000 \ + && platformio settings set check_platforms_interval 1000000 \ + \ + # Build an empty platformio project to force platformio to install all fw build dependencies + # The return-code will be non-zero since there's nothing to build. + && (platformio run -d /opt/pio; echo "Done") \ + \ + # Cleanup + && rm -fr \ + /tmp/* \ + /var/{cache,log}/* \ + /var/lib/apt/lists/* \ + /opt/pio/ # Build arugments -ARG ADDON_ARCH -ARG ADDON_VERSION +ARG BUILD_ARCH=amd64 +ARG BUILD_DATE +ARG BUILD_REF +ARG BUILD_VERSION # Labels LABEL \ io.hass.name="esphomeyaml" \ - io.hass.description="esphomeyaml HassIO add-on for intelligently managing all your ESP8266/ESP32 devices." \ - io.hass.arch="${ADDON_ARCH}" \ + io.hass.description="Manage and program ESP8266/ESP32 microcontrollers through YAML configuration files" \ + io.hass.arch="${BUILD_ARCH}" \ io.hass.type="addon" \ - io.hass.version="${ADDON_VERSION}" \ - io.hass.url="https://esphomelib.com/esphomeyaml/index.html" \ - maintainer="Otto Winter " + io.hass.version=${BUILD_VERSION} \ + maintainer="Otto Winter " \ + org.label-schema.description="Manage and program ESP8266/ESP32 microcontrollers through YAML configuration files" \ + org.label-schema.build-date=${BUILD_DATE} \ + org.label-schema.name="esphomeyaml" \ + org.label-schema.schema-version="1.0" \ + org.label-schema.url="https://esphomelib.com" \ + org.label-schema.usage="https://github.com/OttoWinter/esphomeyaml/tree/dev/esphomeyaml/README.md" \ + org.label-schema.vcs-ref=${BUILD_REF} \ + org.label-schema.vcs-url="https://github.com/OttoWinter/esphomeyaml" \ + org.label-schema.vendor="esphomelib" diff --git a/docker/platformio.ini b/docker/platformio.ini deleted file mode 100644 index 7f6ab6851d..0000000000 --- a/docker/platformio.ini +++ /dev/null @@ -1,12 +0,0 @@ -; This file allows the docker build file to install the required platformio -; platforms - -[env:espressif8266] -platform = espressif8266 -board = nodemcuv2 -framework = arduino - -[env:espressif32] -platform = espressif32 -board = nodemcu-32s -framework = arduino diff --git a/esphomeyaml-edge/Dockerfile b/esphomeyaml-edge/Dockerfile index 7816df2907..8dfbdef037 100644 --- a/esphomeyaml-edge/Dockerfile +++ b/esphomeyaml-edge/Dockerfile @@ -8,12 +8,6 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] # Copy root filesystem COPY rootfs / -# Setup base system -ARG BUILD_ARCH=amd64 - -# Copy root filesystem -COPY rootfs / - RUN \ # Temporarily move nginx.conf (otherwise dpkg fails) mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bkp \ @@ -37,7 +31,7 @@ RUN \ \ && pip2 install --no-cache-dir --no-binary :all: https://github.com/OttoWinter/esphomeyaml/archive/dev.zip \ \ - # tzlocal for automatic timezone detection, requests for HassIO API + # tzlocal for automatic timezone detection && pip2 install --no-cache-dir --no-binary :all: tzlocal \ \ # Change some platformio settings @@ -58,13 +52,14 @@ RUN \ /opt/pio/ # Build arugments +ARG BUILD_ARCH=amd64 ARG BUILD_DATE ARG BUILD_REF ARG BUILD_VERSION # Labels LABEL \ - io.hass.name="esphomeyaml" \ + io.hass.name="esphomeyaml-edge" \ io.hass.description="Manage and program ESP8266/ESP32 microcontrollers through YAML configuration files" \ io.hass.arch="${BUILD_ARCH}" \ io.hass.type="addon" \ @@ -72,10 +67,10 @@ LABEL \ maintainer="Otto Winter " \ org.label-schema.description="Manage and program ESP8266/ESP32 microcontrollers through YAML configuration files" \ org.label-schema.build-date=${BUILD_DATE} \ - org.label-schema.name="esphomeyaml" \ + org.label-schema.name="esphomeyaml-edge" \ org.label-schema.schema-version="1.0" \ org.label-schema.url="https://esphomelib.com" \ org.label-schema.usage="https://github.com/OttoWinter/esphomeyaml/tree/dev/esphomeyaml-edge/README.md" \ org.label-schema.vcs-ref=${BUILD_REF} \ org.label-schema.vcs-url="https://github.com/OttoWinter/esphomeyaml" \ - org.label-schema.vendor="esphomeyaml" + org.label-schema.vendor="esphomelib" diff --git a/esphomeyaml-edge/README.md b/esphomeyaml-edge/README.md index bf395f50ca..997a911fcd 100644 --- a/esphomeyaml-edge/README.md +++ b/esphomeyaml-edge/README.md @@ -1,6 +1,6 @@ # Esphomeyaml HassIO Add-On -![esphomeyaml logo][logo.png] +[![esphomeyaml logo](logo.png)](https://esphomelib.com/esphomeyaml/index.html) ## WARNING! THIS IS AN EDGE VERSION! @@ -21,9 +21,7 @@ directly through HassIO **with no programming experience required**. All you nee is write YAML configuration files; the rest (over-the-air updates, compiling) is all handled by esphomeyaml. -[Click here for the full documentation][docs] - -![esphomeyaml dashboard screenshot][screenshot.png] +![esphomeyaml dashboard screenshot](screenshot.png) ## Installation @@ -39,14 +37,7 @@ first: **NOTE**: Installation on RPis running in 64-bit mode is currently not possible. Please use the 32-bit variant of HassOS instead. -## Docker status - -![Supports armhf Architecture][armhf-shield] -![Supports amd64 Architecture][amd64-shield] -![Supports i386 Architecture][i386-shield] - -[![Docker Layers][layers-shield]][microbadger] -[![Docker Pulls][pulls-shield]][dockerhub] +You can view the esphomeyaml docs here: https://esphomelib.com/esphomeyaml/index.html ## Configuration