2020-08-08 18:42:21 +02:00
|
|
|
ARG BUILD_FROM=esphome/esphome-base-amd64:2.6.0
|
2019-02-13 16:54:02 +01:00
|
|
|
FROM ${BUILD_FROM}
|
|
|
|
|
2020-07-15 15:03:15 +02:00
|
|
|
# First install requirements to leverage caching when requirements don't change
|
|
|
|
COPY requirements.txt /
|
|
|
|
RUN pip3 install --no-cache-dir -r /requirements.txt
|
|
|
|
|
|
|
|
# Then copy esphome and install
|
2019-02-13 16:54:02 +01:00
|
|
|
COPY . .
|
2019-10-19 16:31:03 +02:00
|
|
|
RUN pip3 install --no-cache-dir -e .
|
2019-02-13 16:54:02 +01:00
|
|
|
|
2020-07-15 15:03:15 +02:00
|
|
|
# Settings for dashboard
|
|
|
|
ENV USERNAME="" PASSWORD=""
|
2019-10-13 13:52:02 +02:00
|
|
|
|
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=5m --timeout=3s \
|
|
|
|
CMD curl --fail http://localhost:6052 || exit 1
|
|
|
|
|
2020-07-15 15:03:15 +02:00
|
|
|
# The directory the user should mount their configuration files to
|
2019-02-13 16:54:02 +01:00
|
|
|
WORKDIR /config
|
2020-07-15 15:03:15 +02:00
|
|
|
# Set entrypoint to esphome so that the user doesn't have to type 'esphome'
|
|
|
|
# in every docker command twice
|
2019-02-13 16:54:02 +01:00
|
|
|
ENTRYPOINT ["esphome"]
|
2020-07-15 15:03:15 +02:00
|
|
|
# When no arguments given, start the dashboard in the workdir
|
2019-02-13 16:54:02 +01:00
|
|
|
CMD ["/config", "dashboard"]
|