diff --git a/README.md b/README.md index c02fac3..754b3fb 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ Since version 0.107, the Home Assistant docker image uses the [S6-Overlay](https Finally, some packages on Alpine (Home Assistant's base image) are buggy if not running as root (like ping). For that reason, the custom run script supports installing extra packages, specified in the `PACKAGES` environment variable, before starting Home Assistant. +There is also a option to install python packages in the venv, add your package to the `PIP` environment variable. See the examples below. + ## Usage Follow the [official docs] for installation inside docker. But before you start your container, make sure the script `run` is available in `/config/docker`: @@ -33,6 +35,7 @@ docker run -d \ -e "PUID=1000" \ -e "PGID=1000" \ -e "PACKAGES=iputils" \ + -e "PIP=aiogithubapi" \ -v "/PATH_TO_YOUR_CONFIG:/config" \ -v "/PATH_TO_YOUR_CONFIG/docker/run:/etc/services.d/home-assistant/run" \ --net=host \ @@ -64,6 +67,7 @@ home-assistant: - PGID=1000 - UMASK=007 - PACKAGES=iputils + - PIP=aiogithubapi volumes: - "/PATH_TO_YOUR_CONFIG/config:/config" - "/PATH_TO_YOUR_CONFIG/docker/run:/etc/services.d/home-assistant/run" diff --git a/run b/run index 7e2d39c..da984fb 100755 --- a/run +++ b/run @@ -7,6 +7,7 @@ PGID="${PGID:-1000}" UMASK="${UMASK:-}" PACKAGES="${PACKAGES:-}" +PIP="${PIP:-}" VENV_PATH="${VENV:-/var/tmp/homeassistant-venv}" CONFIG_PATH=/config @@ -79,6 +80,16 @@ fi bashio::log.info "Activating venv" . "$VENV_PATH/bin/activate" +# +# Install Python packages +# + +if [ -n "${PIP}" ]; then + bashio::log.info "Installing extra PYTHON packages: $PIP" + su "$USER" \ + -c "pip install $PIP" +fi + # Everything below should be kept in sync with # core:rootfs/etc/services.d/home-assistant/run # from upstream: @@ -93,3 +104,4 @@ bashio::log.info "Starting homeassistant" exec \ s6-setuidgid "$USER" \ python3 -m homeassistant --config "$CONFIG_PATH" + \ No newline at end of file