From 6d07b12015e2949ba1d36afe79e6a2b2829dcf20 Mon Sep 17 00:00:00 2001 From: Patrick Asmus Date: Wed, 16 Sep 2026 20:32:47 +0200 Subject: [PATCH] APP_VERSION aus Build-Arg statt Hardcoding im Code Version wird jetzt beim Docker-Build per --build-arg injiziert. Release-Workflow leitet sie aus dem Tag-Namen ab, Dev-Workflow nutzt den Short-SHA. Verhindert Version-Mismatch bei Releases. Co-Authored-By: Claude Opus 4.6 --- .gitea/workflows/docker-dev.yaml | 6 ++++++ .gitea/workflows/docker-release.yaml | 4 ++++ Dockerfile | 2 ++ bin/backend/app.py | 2 +- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/docker-dev.yaml b/.gitea/workflows/docker-dev.yaml index 2c003b4..292e86b 100644 --- a/.gitea/workflows/docker-dev.yaml +++ b/.gitea/workflows/docker-dev.yaml @@ -27,7 +27,10 @@ jobs: - name: Build and push amd64 image run: | + SHORT_SHA="${GITHUB_SHA:0:7}" + docker build --pull --platform linux/amd64 \ + --build-arg APP_VERSION="dev-${SHORT_SHA}" \ -t "${IMAGE}:dev-amd64" \ -t "${IMAGE}:dev-${GITHUB_SHA}-amd64" \ . @@ -47,7 +50,10 @@ jobs: - name: Build and push arm64 image run: | + SHORT_SHA="${GITHUB_SHA:0:7}" + docker build --pull --platform linux/arm64 \ + --build-arg APP_VERSION="dev-${SHORT_SHA}" \ -t "${IMAGE}:dev-arm64" \ -t "${IMAGE}:dev-${GITHUB_SHA}-arm64" \ . diff --git a/.gitea/workflows/docker-release.yaml b/.gitea/workflows/docker-release.yaml index f9850a6..d216831 100644 --- a/.gitea/workflows/docker-release.yaml +++ b/.gitea/workflows/docker-release.yaml @@ -23,8 +23,10 @@ jobs: - name: Build and push amd64 release image run: | RELEASE_TAG="${GITHUB_REF_NAME}" + VERSION="${RELEASE_TAG#v}" docker build --pull --platform linux/amd64 \ + --build-arg APP_VERSION="${VERSION}" \ -t "${IMAGE}:${RELEASE_TAG}-amd64" \ . docker push "${IMAGE}:${RELEASE_TAG}-amd64" @@ -43,8 +45,10 @@ jobs: - name: Build and push arm64 release image run: | RELEASE_TAG="${GITHUB_REF_NAME}" + VERSION="${RELEASE_TAG#v}" docker build --pull --platform linux/arm64 \ + --build-arg APP_VERSION="${VERSION}" \ -t "${IMAGE}:${RELEASE_TAG}-arm64" \ . docker push "${IMAGE}:${RELEASE_TAG}-arm64" diff --git a/Dockerfile b/Dockerfile index ce2f863..75083fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,8 @@ COPY bin/config.yml.dist /app/config.yml.dist RUN mkdir -p /app/data/recordings +ARG APP_VERSION=dev +ENV APP_VERSION=${APP_VERSION} ENV DATA_DIR=/app/data ENV STATIC_DIR=/app/frontend/static ENV PYTHONUNBUFFERED=1 diff --git a/bin/backend/app.py b/bin/backend/app.py index 7177019..d6de1a5 100644 --- a/bin/backend/app.py +++ b/bin/backend/app.py @@ -17,7 +17,7 @@ from models import init_db, get_session, Job, Station, Recording as RecordingMod from recorder import RecordingManager, format_elapsed from scheduler import StreamScheduler -APP_VERSION = "3.1.0" +APP_VERSION = os.environ.get("APP_VERSION", "dev") DATA_DIR = os.environ.get("DATA_DIR", "/app/data") STATIC_DIR = os.environ.get("STATIC_DIR", "/app/frontend/static")