diff --git a/Dockerfile b/Dockerfile index 7bef078..3f59f84 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,12 +24,12 @@ COPY --from=deps /app/node_modules ./node_modules COPY . . # Extract version: use build arg if provided, otherwise get from git, fallback to package.json +# Only use tags that are reachable from the current commit to ensure version matches the code RUN if [ -n "$APP_VERSION" ]; then \ echo "$APP_VERSION" > /tmp/version.txt; \ else \ (git describe --tags --exact-match 2>/dev/null || \ git describe --tags --abbrev=0 2>/dev/null || \ - git tag --sort=-version:refname | head -1 2>/dev/null || \ (grep -o '"version": "[^"]*"' package.json 2>/dev/null | cut -d'"' -f4 | sed 's/^/v/') || \ echo "dev") > /tmp/version.txt; \ fi && \