Dockerfile 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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=0.118.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. RUN apk add --no-cache \
  20. gcc \
  21. musl-dev \
  22. tini
  23. # not inherited:
  24. EXPOSE 8123/tcp
  25. # why do the home assistant maintainers run their containers as root?!
  26. RUN python3 -c 'import os; assert os.geteuid() == 0, "finally..."' \
  27. && find / -xdev -type f -perm /u+s -exec chmod -c u-s {} \; \
  28. && find / -xdev -type f -perm /g+s -exec chmod -c g-s {} \; \
  29. && adduser -D hass \
  30. && chown hass /config \
  31. && mkdir -p ~hass/.config/pip \
  32. && echo -e '[install]\nuser = yes' > ~hass/.config/pip/pip.conf
  33. VOLUME /config
  34. USER hass
  35. # > $ docker inspect --format '{{json .Config.Entrypoint}}' homeassistant/home-assistant:0.106.6
  36. # > ["/bin/entry.sh"]
  37. # > $ dockerinspect --format '{{json .Config.Cmd}}' homeassistant/home-assistant:0.106.6
  38. # > ["python3","-m","homeassistant","--config","/config"]
  39. # > $ dockerinspect --format '{{json .Config.Entrypoint}}' homeassistant/home-assistant:0.107.0
  40. # > ["/init"]
  41. # > $ dockerinspect --format '{{json .Config.Cmd}}' homeassistant/home-assistant:0.107.0
  42. # > null
  43. # see https://github.com/home-assistant/docker-base/pull/62
  44. # > 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).
  45. # src: https://github.com/just-containers/s6-overlay/blame/v1.22.1.0/README.md#L420
  46. # workaround: disable useless (but annoying) s6-overlay
  47. ENTRYPOINT ["tini", "--"]
  48. # default in home-assistant<0.107.0
  49. CMD ["python3", "-m", "homeassistant", "--config", "/config"]