esphome/docker/Dockerfile

31 lines
993 B
Text
Raw Normal View History

ARG BUILD_FROM=esphome/esphome-base:latest
FROM ${BUILD_FROM}
# First install requirements to leverage caching when requirements don't change
2021-06-08 22:03:04 +02:00
COPY requirements.txt requirements_optional.txt docker/platformio_install_deps.py platformio.ini /
RUN \
2021-06-08 22:03:04 +02:00
pip3 install --no-cache-dir -r /requirements.txt -r /requirements_optional.txt \
&& /platformio_install_deps.py /platformio.ini
# Then copy esphome and install
COPY . .
RUN pip3 install --no-cache-dir -e .
# Settings for dashboard
ENV USERNAME="" PASSWORD=""
2020-12-30 10:58:09 +01:00
# Expose the dashboard to Docker
EXPOSE 6052
2021-01-27 07:16:59 +01:00
# Run healthcheck (heartbeat)
HEALTHCHECK --interval=30s --timeout=30s \
2021-01-27 07:16:59 +01:00
CMD curl --fail http://localhost:6052 || exit 1
# The directory the user should mount their configuration files to
WORKDIR /config
# Set entrypoint to esphome so that the user doesn't have to type 'esphome'
# in every docker command twice
ENTRYPOINT ["esphome"]
# When no arguments given, start the dashboard in the workdir
CMD ["dashboard", "/config"]