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