Files
tsun-gen3-proxy/ha_addon/Dockerfile
metzi 45b57109a8 Add on (#212)
* added service to transfer Add-on config from options.json to config.toml

* added feature to get MQTT config from Homeassistant

current version is MVP. can run as Home Assistant Add-On, config.toml is automatically created from option parameters in the add-on configuration tab.

* fix pylance and flake8 warnings

* prepare building a ha addon

- move build script into root dir
- cp source files in addon build-tree

* ignore proxy source files in addon build tree

* move proxy source files in own directory

* remove duplicates source files from repro

* check for a valis SONAR_TOKEN

* rename add_on path

* prepare for unittests and coverage measurement

* move file cause of the changes pathname

* move the proxy dir to /home/proxy

* build addon with make now

* remove duplicated requirements.txt file from repo

* undo changes

---------

Co-authored-by: Michael Metz <michael.metz@siemens.com>
Co-authored-by: Stefan Allius <stefan.allius@t-online.de>
2024-11-29 21:02:19 +01:00

98 lines
1.8 KiB
Docker
Executable File

############################################################################
#
# TSUN Proxy
# Homeassistant Add-on
#
# based on https://github.com/s-allius/tsun-gen3-proxy/tree/main
#
############################################################################
######################
# 1 Build Image #
######################
# opt for suitable build base. I opted for the recommended hassio-addon base
#ARG BUILD_FROM="ghcr.io/hassio-addons/debian-base:latest"
ARG BUILD_FROM="ghcr.io/hassio-addons/base:latest"
FROM $BUILD_FROM
#######################
# 2 Modify Image #
#######################
#######################
# 3 Install apps #
#######################
# Installiere Python, pip und virtuelle Umgebungstools
RUN apk add --no-cache python3 py3-pip py3-virtualenv
# Erstelle ein virtuelles Umfeld und aktiviere es
RUN python3 -m venv /opt/venv
RUN . /opt/venv/bin/activate
# Stelle sicher, dass das Add-on das virtuelle Umfeld nutzt
ENV PATH="/opt/venv/bin:$PATH"
#######################
# 4 Install libraries #
#######################
# Kopiere die requirements.txt Datei in das Image
COPY rootfs/requirements.txt /tmp/requirements.txt
# installiere die Pakete aus requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
#######################
# 5 copy data #
#######################
# Add rootfs
COPY rootfs/ /
# make run.sh executable
RUN chmod a+x /run.sh
# no idea whether needed or not
ENV SERVICE_NAME="tsun-proxy"
ENV UID=1000
ENV GID=1000
ENV VERSION="0.0"
#######################
# 6 run app #
#######################
# command to run on container start
CMD [ "/run.sh" ]
#######################
# Labels
LABEL \
io.hass.version="VERSION" \
io.hass.type="addon" \
io.hass.arch="armhf|aarch64|i386|amd64"