From 396587554ac072c97784b2909c527add28c22c3a Mon Sep 17 00:00:00 2001 From: rxf Date: Tue, 26 May 2026 11:46:49 +0200 Subject: [PATCH] Fix: Version aus APP_VERSION-Env statt pyproject.toml lesen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pyproject.toml wird nicht ins Docker-Image kopiert und war zur Laufzeit nicht vorhanden. deploy.sh übergibt VERSION bereits als Build-Arg, das jetzt als ENV APP_VERSION im Image gesetzt wird. Co-Authored-By: Claude Sonnet 4.6 --- Dockerfile | 3 +++ weather_report.py | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3576228..ad20e8d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,9 @@ WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt +ARG VERSION=unknown +ENV APP_VERSION=${VERSION} + COPY weather_report.py . RUN mkdir -p images diff --git a/weather_report.py b/weather_report.py index 0786c28..a4e7ab7 100644 --- a/weather_report.py +++ b/weather_report.py @@ -2,8 +2,6 @@ """Erstellt einen kombinierten Wetterbericht für den letzten Kalendermonat.""" import os -import pathlib -import re import smtplib import tempfile from collections import defaultdict @@ -20,9 +18,7 @@ from dotenv import load_dotenv load_dotenv() -_v = re.search(r'^version\s*=\s*"([^"]+)"', - pathlib.Path("pyproject.toml").read_text(), re.MULTILINE) -VERSION = _v.group(1) if _v else "?" +VERSION = os.getenv("APP_VERSION", "?") API_BASE_URL = os.getenv("API_BASE_URL", "https://stwwetter.fuerst-stuttgart.de/api") MAIL_SERVER = os.getenv("MAIL_SERVER")