* add ha_addons repository to cscode workspace * Issue220 ha addon dokumentation update (#232) * initial DOCS.md for Addon * links to Mosquitto and Adguard * replaced _ by . for PV-Strings * mentioned add-on installation method in README.md * fix most of the markdown linter warnings * add missing alt texts * added nice add repository to my Home Assistant badges --------- Co-authored-by: Michael Metz <michael.metz@siemens.com> Co-authored-by: Stefan Allius <stefan.allius@t-online.de> * S allius/issue216 (#235) * improve docker run - establish multistage Dockerfile - build a python wheel for all needed packages - remove unneeded tools like apk for runtime * pin versions, fix hadolint warnings * merge from dev-0.12 --------- Co-authored-by: Michael Metz <michael.metz@siemens.com> * Issue220 ha addon dokumentation update (#245) * revised config disclaimer * add newline at end of file to fix linter warning --------- Co-authored-by: Michael Metz <michael.metz@siemens.com> * 238 ha addon repository check (#244) * move Makefile and bake file into parent folder * build config.yaml from template * use Makefile instead of build shell script * ignore temporary or created files * add rules for building the add-on repository * add rel version of add-on * add jinja2-cli * ignore inverter replays which a older than 1 day (#246) * S allius/issue7 (#248) * report alarm and fault bitfield to ha * define the alarm and fault names * configure log path and max number of daily log files (#243) * configure log path and max number of daily log files * don't use a subfolder for configs * use make instead of a build script * mount /homeassistant/tsun-proxy * Add venv to base image * give write access to mounted folder * intial checkin, ignore SC1091 * set advanced and stage value in config.yaml * fix typo * added watchdog and removed Port 8127 from mapping * fixed typo and use new add-on repro - change the install button to install from https://github.com/s-allius/ha-addons * add addon-rel target * disable watchdog due to exceptions in the ha supervisor * update changelog --------- Co-authored-by: Michael Metz <michael.metz@siemens.com> * Update README.md (#251) install `https://github.com/s-allius/ha-addons` as repro for our add-on * add german language file (#253) * fix return type get_extra_info in FakeWriter * move global startup code into main methdod * pin version of base image * avoid forwarding to a private (lokal) IP addr (#256) * avoid forwarding to a private (lokal) IP addr * test DNS resolver issues * increase test coverage * update changelog * fix client_mode configuration block (#252) * fix client_mode block * add client mode * fix tests with client_mode values * log client_mode configuration * add forward flag for client_mode * improve startup logging * added client_mode example * adjusted translation files * AT commands added * typo * missing "PLUS" * link to config details * improve log msg for config problems * improve log msg on config errors * improve log msg for config problems * copy CHANGELOG.md into add-on repro --------- Co-authored-by: Michael Metz <michael.metz@siemens.com> * rename "ConfigErr" to match naming convention * disable test coverage for __main__ * update changelog version 0.12 --------- Co-authored-by: metzi <147942647+mime24@users.noreply.github.com> Co-authored-by: Michael Metz <michael.metz@siemens.com>
71 lines
1.9 KiB
Docker
71 lines
1.9 KiB
Docker
ARG SERVICE_NAME="tsun-proxy"
|
|
ARG UID=1000
|
|
ARG GID=1000
|
|
|
|
#
|
|
# first stage for our base image
|
|
FROM python:3.13-alpine AS base
|
|
|
|
COPY --chmod=0700 ./hardening_base.sh /
|
|
RUN apk upgrade --no-cache && \
|
|
apk add --no-cache su-exec=0.2-r3 && \
|
|
/hardening_base.sh && \
|
|
rm /hardening_base.sh
|
|
|
|
#
|
|
# second stage for building wheels packages
|
|
FROM base AS builder
|
|
|
|
# copy the dependencies file to the root dir and install requirements
|
|
COPY ./requirements.txt /root/
|
|
RUN apk add --no-cache build-base=0.5-r3 && \
|
|
python -m pip install --no-cache-dir pip==24.3.1 wheel==0.45.1 && \
|
|
python -OO -m pip wheel --no-cache-dir --wheel-dir=/root/wheels -r /root/requirements.txt
|
|
|
|
|
|
#
|
|
# third stage for our runtime image
|
|
FROM base AS runtime
|
|
ARG SERVICE_NAME
|
|
ARG VERSION
|
|
ARG UID
|
|
ARG GID
|
|
ARG LOG_LVL
|
|
ARG environment
|
|
|
|
ENV SERVICE_NAME=$SERVICE_NAME
|
|
ENV UID=$UID
|
|
ENV GID=$GID
|
|
ENV LOG_LVL=$LOG_LVL
|
|
ENV HOME=/home/$SERVICE_NAME
|
|
|
|
|
|
# set the working directory in the container
|
|
WORKDIR /home/$SERVICE_NAME
|
|
|
|
VOLUME ["/home/$SERVICE_NAME/log", "/home/$SERVICE_NAME/config"]
|
|
|
|
# install the requirements from the wheels packages from the builder stage
|
|
# and unistall python packages and alpine package manger to reduce attack surface
|
|
COPY --from=builder /root/wheels /root/wheels
|
|
COPY --chmod=0700 ./hardening_final.sh .
|
|
RUN python -m pip install --no-cache-dir --no-cache --no-index /root/wheels/* && \
|
|
rm -rf /root/wheels && \
|
|
python -m pip uninstall --yes wheel pip && \
|
|
apk --purge del apk-tools && \
|
|
./hardening_final.sh && \
|
|
rm ./hardening_final.sh
|
|
|
|
|
|
# copy the content of the local src and config directory to the working directory
|
|
COPY --chmod=0700 entrypoint.sh /root/entrypoint.sh
|
|
COPY config .
|
|
COPY src .
|
|
RUN echo ${VERSION} > /proxy-version.txt \
|
|
&& date > /build-date.txt
|
|
EXPOSE 5005 8127 10000
|
|
|
|
# command to run on container start
|
|
ENTRYPOINT ["/root/entrypoint.sh"]
|
|
CMD [ "python3", "./server.py" ]
|