# Copyright © 2026 Setti Solutions S.R.L, www.setti.md. All rights reserved.
# The add-on's image: the Edge Agent image (src/edge) with addon-run in
# front, Cantabile's device profiles (src/profiles; the agent proposes a
# mapping from them, propose.py), and the platform it belongs to: the devices
# URL and the command and bundle certificates (cantabile_edge/platform/,
# README.md there). Built from the repository's root:
#   docker build -t cantabile-edge:local src/edge
#   docker build -f cantabile_edge/Dockerfile --build-arg EDGE_IMAGE=cantabile-edge:local \
#     --build-arg VERSION=<v> -t cantabile-ha-edge-amd64:<v> .
ARG EDGE_IMAGE=cantabile-edge:local
FROM ${EDGE_IMAGE}
ARG VERSION ARCH=amd64 REVISION
LABEL io.hass.version="${VERSION}" io.hass.type="addon" io.hass.arch="${ARCH}" \
      org.opencontainers.image.revision="${REVISION}"
# addon.env and commands.pem are needed at run time; bundles.pem and
# devices-ca.pem are optional.
COPY cantabile_edge/platform/ /etc/cantabile/
COPY cantabile_edge/addon-run /usr/local/bin/addon-run
COPY src/profiles/*.json /usr/share/cantabile/profiles/
# addon-run starts as root (it reads Home Assistant's instance id) and runs
# the agent as uid 10001.
USER root
ENTRYPOINT ["addon-run"]
CMD []
