From eec85a323e7c72a78da7651249befee5f3720dd1 Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Fri, 3 Apr 2026 12:51:16 +0200 Subject: [PATCH 1/4] Use supported base image, Fix docker build --- docker/dockerfile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docker/dockerfile b/docker/dockerfile index b082f9e3..c58c871d 100644 --- a/docker/dockerfile +++ b/docker/dockerfile @@ -1,4 +1,4 @@ -FROM python:3.7-slim +FROM python:3.11-slim ENV LANG en_US.UTF-8 ENV LC_ALL en_US.UTF-8 @@ -11,16 +11,19 @@ RUN apt-get install -y locales && locale-gen en_US.UTF-8 #Install required python packages RUN pip install paho-mqtt -RUN pip install requests +RUN pip install requests RUN pip install influxdb -RUN pip install influxdb-client +RUN pip install influxdb-client COPY grott.py /app/grott.py COPY grottconf.py /app/grottconf.py COPY grottdata.py /app/grottdata.py COPY grottproxy.py /app/grottproxy.py COPY grottsniffer.py /app/grottsniffer.py -COPY grott.ini /app/grott.ini +COPY grottserver.py /app/grottserver.py +COPY examples/grott.ini /app/grott.ini +COPY examples/Extensions/grottext.py /app/grottext.py +COPY examples/Extensions/grotcsv.py /app/grotcsv.py WORKDIR /app -CMD ["python", "-u", "grott.py", "-v"] \ No newline at end of file +CMD ["python", "-u", "grott.py", "-v"] From e20dbd0adb19e3d357eccb4f228951b4638a7641 Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Wed, 8 Apr 2026 12:29:17 +0200 Subject: [PATCH 2/4] Use newer base image and optimize builds --- docker/dockerfile | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/docker/dockerfile b/docker/dockerfile index c58c871d..ebf696a3 100644 --- a/docker/dockerfile +++ b/docker/dockerfile @@ -1,29 +1,23 @@ -FROM python:3.11-slim +FROM python:3.12-slim ENV LANG en_US.UTF-8 ENV LC_ALL en_US.UTF-8 # Run updates -RUN apt-get clean && apt-get update && apt-get upgrade -y - -# Set the locale -RUN apt-get install -y locales && locale-gen en_US.UTF-8 +RUN apt-get clean && apt-get update && apt-get upgrade -y && apt-get install -y locales && locale-gen en_US.UTF-8 #Install required python packages -RUN pip install paho-mqtt -RUN pip install requests -RUN pip install influxdb -RUN pip install influxdb-client +RUN pip install --no-cache-dir \ + psutil \ + paho-mqtt \ + requests \ + influxdb \ + influxdb-client -COPY grott.py /app/grott.py -COPY grottconf.py /app/grottconf.py -COPY grottdata.py /app/grottdata.py -COPY grottproxy.py /app/grottproxy.py -COPY grottsniffer.py /app/grottsniffer.py -COPY grottserver.py /app/grottserver.py -COPY examples/grott.ini /app/grott.ini -COPY examples/Extensions/grottext.py /app/grottext.py -COPY examples/Extensions/grotcsv.py /app/grotcsv.py +COPY grott.py grottconf.py grottdata.py grottproxy.py \ + grottsniffer.py grottserver.py examples/grott.ini \ + examples/Extensions/grottext.py examples/Extensions/grotcsv.py \ + /app/ WORKDIR /app CMD ["python", "-u", "grott.py", "-v"] From b9d27570162b687b140576153e0ef0ea678b45df Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Wed, 8 Apr 2026 12:29:45 +0200 Subject: [PATCH 3/4] Add links to index page --- grottserver.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/grottserver.py b/grottserver.py index f3267c0a..cfcf8ff3 100644 --- a/grottserver.py +++ b/grottserver.py @@ -249,10 +249,18 @@ def do_GET(self): f.close() return except IOError: - responsetxt = b"

Welcome to Grott the growatt inverter monitor: " + str.encode(vrmserver) + b"


Made by Ledidobe, Johan Meijer

" + responsetxt = b"""

Welcome to Grott the growatt inverter monitor: """ + str.encode(vrmserver) + b"""

+

Made by Ledidobe, Johan Meijer

+

Supported paths:

+
    +
  • Server Info - View server status and connection information
  • +
  • Datalogger - Datalogger operations and registry
  • +
  • Inverter - Inverter operations and registry
  • +
  • Help - Help documentation
  • +
""" responserc = 200 responseheader = "text/html" - htmlsendresp(self,responserc,responseheader,responsetxt) + htmlsendresp(self, responserc, responseheader, responsetxt) return elif self.path.startswith("info"): From 1c4753948934021180cebd775dc22c8766ee8566 Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Fri, 3 Apr 2026 12:51:39 +0200 Subject: [PATCH 4/4] Auto build images --- .github/workflows/docker-image.yml | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 00000000..6668082a --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,49 @@ +name: Build and Push Docker Image + +on: + push: + branches: [ "main" ] + workflow_dispatch: # Allows you to run it manually if needed + +jobs: + build: + runs-on: ubuntu-latest + # Added permissions for GHCR + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Metadata (Tags/Labels) + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/grott + tags: | + type=sha,format=short + type=raw,value=latest + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: docker/dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + # Added caching to speed up subsequent builds + cache-from: type=gha + cache-to: type=gha,mode=max