Dockerfile 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # https://hub.docker.com/r/homeassistant/home-assistant/tags
  2. # https://github.com/home-assistant/core/blob/0.109.3/azure-pipelines-release.yml#L76
  3. ARG HOME_ASSISTANT_VERSION=2021.3.4
  4. FROM homeassistant/home-assistant:$HOME_ASSISTANT_VERSION
  5. # Adafruit-DHT: no wheel available
  6. # https://pypi.org/project/Adafruit-DHT/1.4.0/#files
  7. # https://wheels.home-assistant.io/alpine-3.10/armv7/
  8. #> $ sudo docker run --rm homeassistant/home-assistant:0.104.3 pip freeze | grep -i adafruit
  9. #> starting version 3.2.8
  10. #> Adafruit-Blinka==1.2.1
  11. #> adafruit-circuitpython-busdevice==4.1.1
  12. #> adafruit-circuitpython-mcp230xx==1.1.2
  13. #> Adafruit-GPIO==1.0.3
  14. #> Adafruit-PCA9685==1.0.1
  15. #> Adafruit-PlatformDetect==1.4.5
  16. #> Adafruit-PureIO==1.0.4
  17. #> Adafruit-SHT31==1.0.2
  18. # but no 'Adafruit-DHT'
  19. # hadolint ignore=DL3018
  20. RUN apk add --no-cache \
  21. gcc \
  22. musl-dev \
  23. tini
  24. # not inherited:
  25. EXPOSE 8123/tcp
  26. # why do the home assistant maintainers run their containers as root?!
  27. RUN python3 -c 'import os; assert os.geteuid() == 0, "finally..."' \
  28. && find / -xdev -type f -perm /u+s -exec chmod -c u-s {} \; \
  29. && find / -xdev -type f -perm /g+s -exec chmod -c g-s {} \; \
  30. && adduser -D hass \
  31. && chown hass /config \
  32. && mkdir -p ~hass/.config/pip \
  33. && echo -e '[install]\nuser = yes' > ~hass/.config/pip/pip.conf
  34. VOLUME /config
  35. # > WARNING (MainThread) [matplotlib] Matplotlib created a temporary config/cache directory at /tmp/matplotlib-[...] \
  36. # > it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, \
  37. # > in particular to speed up the import of Matplotlib and to better support multiprocessing.
  38. ENV MPLCONFIGDIR=/config/matplotlib
  39. USER hass
  40. # > $ docker inspect --format '{{json .Config.Entrypoint}}' homeassistant/home-assistant:0.106.6
  41. # > ["/bin/entry.sh"]
  42. # > $ dockerinspect --format '{{json .Config.Cmd}}' homeassistant/home-assistant:0.106.6
  43. # > ["python3","-m","homeassistant","--config","/config"]
  44. # > $ dockerinspect --format '{{json .Config.Entrypoint}}' homeassistant/home-assistant:0.107.0
  45. # > ["/init"]
  46. # > $ dockerinspect --format '{{json .Config.Cmd}}' homeassistant/home-assistant:0.107.0
  47. # > null
  48. # see https://github.com/home-assistant/docker-base/pull/62
  49. # > For now, `s6-overlay` doesn't support running it with a user different than `root`, so consequently Dockerfile `USER` directive is not supported (except `USER root` of course ;P).
  50. # src: https://github.com/just-containers/s6-overlay/blame/v1.22.1.0/README.md#L420
  51. # workaround: disable useless (but annoying) s6-overlay
  52. ENTRYPOINT ["tini", "--"]
  53. # default in home-assistant<0.107.0
  54. CMD ["python3", "-m", "homeassistant", "--config", "/config"]
  55. # https://github.com/opencontainers/image-spec/blob/v1.0.1/annotations.md
  56. ARG REVISION=
  57. LABEL org.opencontainers.image.title="homeassistant/home-assistant:$HOME_ASSISTANT_VERSION running as unprivileged user" \
  58. org.opencontainers.image.source="https://github.com/fphammerle/docker-home-assistant" \
  59. org.opencontainers.image.revision="$REVISION"