Fix: Versionsanzeige im Footer - Git-Tags während Docker-Build verfügbar machen und Fallbacks hinzufügen

This commit is contained in:
Hördle Bot
2025-12-01 17:43:24 +01:00
parent 725d3bcff4
commit 891f52b0b8
3 changed files with 21 additions and 6 deletions

View File

@@ -23,11 +23,13 @@ RUN apk add --no-cache git
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Extract version: use build arg if provided, otherwise get from git
# Extract version: use build arg if provided, otherwise get from git, fallback to package.json
RUN if [ -n "$APP_VERSION" ]; then \
echo "$APP_VERSION" > /tmp/version.txt; \
else \
git describe --tags --always 2>/dev/null > /tmp/version.txt || echo "unknown" > /tmp/version.txt; \
(git describe --tags --always 2>/dev/null || \
(grep -o '"version": "[^"]*"' package.json 2>/dev/null | cut -d'"' -f4 | sed 's/^/v/') || \
echo "dev") > /tmp/version.txt; \
fi && \
echo "Building version: $(cat /tmp/version.txt)"