#
# Dockerfile for hass-arm (Home Assistant)
#

FROM debian:bullseye
MAINTAINER EasyPi Software Foundation

ENV HASS_VERSION=2021.11.1
ENV HASS_CLI_VERSION=4.14.0

ARG HASS_CLI_ARCH=armhf

RUN set -xe \
    && apt-get update \
    && apt-get install -y \
        build-essential \
        bluez \
        curl \
        libbluetooth3 \
        libbluetooth-dev \
        libboost-python-dev \
        libboost-thread-dev \
        libglib2.0 \
        libglib2.0-dev \
        pkg-config \
        python-dev \
        python3-dev \
    && curl https://bootstrap.pypa.io/get-pip.py | python3 \
    && pip3 install --no-cache-dir \
        gattlib \
        homeassistant \
        pybluez \
    && setcap 'cap_net_raw,cap_net_admin+eip' /usr/bin/python3.9 \
    && apt-get remove -y \
        curl \
        libbluetooth-dev \
        libboost-python-dev \
        libboost-thread-dev \
        libglib2.0-dev \
        pkg-config \
        python-dev

VOLUME /etc/hass
EXPOSE 8123
ENTRYPOINT ["hass", "--config", "/etc/hass"]
