1
0
mirror of https://github.com/esphome/esphome.git synced 2024-10-06 19:00:59 +01:00
esphome/esphomeyaml/Dockerfile

47 lines
1.7 KiB
Docker
Raw Normal View History

2018-06-01 17:45:23 +01:00
# Dockerfile for HassIO add-on
2018-06-03 18:22:25 +01:00
ARG BUILD_FROM=ubuntu:bionic
FROM ${BUILD_FROM}
2018-06-01 17:45:23 +01:00
2018-06-03 18:22:25 +01:00
# Re-declare BUILD_FROM to fix weird docker issue
ARG BUILD_FROM
ARG BUILD_VERSION
2018-06-01 17:45:23 +01:00
2018-06-03 18:22:25 +01:00
# On amd64 and alike, using ubuntu as the base is better as building
# for the ESP32 only works with glibc (and ubuntu). However, on armhf
# the build toolchain frequently procudes segfaults under ubuntu.
# -> Use ubuntu for most architectures, except alpine for armhf
#
# * python and related required because this is a python project
# * git required for platformio library dependencies downloads
# * libc6-compat and openssh required on alpine for weird reasons
# * disable platformio telemetry on install
RUN /bin/bash -c "if [[ '$BUILD_FROM' = *\"ubuntu\"* ]]; then \
apt-get update && apt-get install -y --no-install-recommends \
python python-pip python-setuptools git && \
rm -rf /var/lib/apt/lists/* /tmp/*; \
else \
apk add --no-cache python2 py2-pip git openssh libc6-compat; \
fi" && \
2018-06-01 17:45:23 +01:00
pip install --no-cache-dir platformio && \
2018-06-03 18:22:25 +01:00
platformio settings set enable_telemetry No
# Create fake project to make platformio install all depdencies.
# * Ignore build errors from platformio - empty project
# * On alpine, only install ESP8266 toolchain
COPY platformio.ini /pio/platformio.ini
RUN /bin/bash -c "if [[ '$BUILD_FROM' = *\"ubuntu\"* ]]; then \
platformio run -e espressif32 -e espressif8266 -d /pio; \
else \
echo \"\$(head -8 /pio/platformio.ini)\" >/pio/platformio.ini; \
platformio run -e espressif8266 -d /pio; \
fi"; rm -rf /pio
2018-06-01 17:45:23 +01:00
2018-06-03 18:22:25 +01:00
# Install latest esphomeyaml from git
2018-06-01 17:45:23 +01:00
RUN pip install --no-cache-dir \
2018-06-03 18:22:25 +01:00
esphomeyaml==${BUILD_VERSION} \
tornado \
esptool
2018-06-01 17:45:23 +01:00
CMD ["esphomeyaml", "/config/esphomeyaml", "dashboard"]