Dockerfile 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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.1.5
  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. USER hass
  36. # > $ docker inspect --format '{{json .Config.Entrypoint}}' homeassistant/home-assistant:0.106.6
  37. # > ["/bin/entry.sh"]
  38. # > $ dockerinspect --format '{{json .Config.Cmd}}' homeassistant/home-assistant:0.106.6
  39. # > ["python3","-m","homeassistant","--config","/config"]
  40. # > $ dockerinspect --format '{{json .Config.Entrypoint}}' homeassistant/home-assistant:0.107.0
  41. # > ["/init"]
  42. # > $ dockerinspect --format '{{json .Config.Cmd}}' homeassistant/home-assistant:0.107.0
  43. # > null
  44. # see https://github.com/home-assistant/docker-base/pull/62
  45. # > 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).
  46. # src: https://github.com/just-containers/s6-overlay/blame/v1.22.1.0/README.md#L420
  47. # workaround: disable useless (but annoying) s6-overlay
  48. ENTRYPOINT ["tini", "--"]
  49. # default in home-assistant<0.107.0
  50. CMD ["python3", "-m", "homeassistant", "--config", "/config"]