diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 5e1f17a..67b1a83 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -47,7 +47,10 @@ jobs: - name: Build Web image run: | - docker build -f web/Dockerfile -t "${REGISTRY_HOST}/${WEB_IMAGE}:${IMAGE_TAG}" . + APP_VERSION="1.0.$(git rev-list --count HEAD)" + docker build -f web/Dockerfile \ + --build-arg APP_VERSION="${APP_VERSION}" \ + -t "${REGISTRY_HOST}/${WEB_IMAGE}:${IMAGE_TAG}" . - name: Build CV cleanup job image run: | diff --git a/docker-compose/.env.template b/docker-compose/.env.template index 3e24c53..95646d1 100644 --- a/docker-compose/.env.template +++ b/docker-compose/.env.template @@ -7,6 +7,10 @@ # For local dev this is ignored (docker-compose.override.yml builds images locally). IMAGE_TAG=staging +# Application version displayed in the web UI footer. +# CI sets this automatically to 1.0. at build time. +APP_VERSION=1.0.0 + # Volume base paths — controls where logs and uploaded files are stored on the host. # Portainer (staging/prod): leave unset to use the /opt/myai defaults. # Local dev: set to relative paths so logs and files land in the repo tree. diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index 87bc49f..3b617b8 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -263,6 +263,7 @@ services: - ASPNETCORE_URLS=${ASPNETCORE_URLS:-http://+:8080} - APP_ENVIRONMENT_NAME=${APP_ENVIRONMENT_NAME:-myai.staging} + - APP_VERSION=${APP_VERSION:-unknown} - Site__Mode=${Site__Mode:-Normal} networks: - myai-network diff --git a/web/Dockerfile b/web/Dockerfile index 49d964d..aa56baf 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -13,6 +13,8 @@ FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final WORKDIR /app EXPOSE 8080 ENV ASPNETCORE_URLS=http://0.0.0.0:8080 +ARG APP_VERSION=1.0.0 +ENV APP_VERSION=${APP_VERSION} COPY --from=build /app/publish . ENTRYPOINT ["dotnet", "web.dll"] \ No newline at end of file diff --git a/web/Program.cs b/web/Program.cs index c14b1dd..9e4777b 100644 --- a/web/Program.cs +++ b/web/Program.cs @@ -14,6 +14,9 @@ var app = builder.Build(); app.UseMiddleware(); +app.MapGet("/version", (IConfiguration config) => + Results.Json(new { version = config["APP_VERSION"] ?? "unknown" })); + // Static site app.UseDefaultFiles(); app.UseStaticFiles(); diff --git a/web/wwwroot/css/myai.css b/web/wwwroot/css/myai.css index 1f9b56b..b1b060b 100644 --- a/web/wwwroot/css/myai.css +++ b/web/wwwroot/css/myai.css @@ -607,6 +607,13 @@ img { flex-wrap: wrap } +.app-version { + font-size: .7rem; + color: var(--muted); + opacity: .5; + font-family: monospace +} + .cookie-overlay { position: fixed; left: 0; diff --git a/web/wwwroot/cv-matcher/index.html b/web/wwwroot/cv-matcher/index.html index 2b43d29..b1fce85 100644 --- a/web/wwwroot/cv-matcher/index.html +++ b/web/wwwroot/cv-matcher/index.html @@ -186,6 +186,7 @@ Privacy Cookies + Back to top diff --git a/web/wwwroot/index.html b/web/wwwroot/index.html index ea34c69..7fd7a86 100644 --- a/web/wwwroot/index.html +++ b/web/wwwroot/index.html @@ -189,6 +189,7 @@ Privacy Cookies + Back to top diff --git a/web/wwwroot/js/main.js b/web/wwwroot/js/main.js index 8871a48..3cd183e 100644 --- a/web/wwwroot/js/main.js +++ b/web/wwwroot/js/main.js @@ -262,6 +262,13 @@ } $('#year').text(new Date().getFullYear()); + + $.getJSON('/version').done(function (data) { + if (data && data.version) { + $('#app-version').text('v' + data.version); + } + }); + applyLanguage(currentLang()); $('.lang-flag').on('click', function () { applyLanguage($(this).data('lang'));