diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml
index 67b1a83..5e1f17a 100644
--- a/.gitea/workflows/build.yml
+++ b/.gitea/workflows/build.yml
@@ -47,10 +47,7 @@ jobs:
- name: Build Web image
run: |
- 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}" .
+ docker build -f web/Dockerfile -t "${REGISTRY_HOST}/${WEB_IMAGE}:${IMAGE_TAG}" .
- name: Build CV cleanup job image
run: |
diff --git a/Apis/api/Controllers/HealthController.cs b/Apis/api/Controllers/HealthController.cs
index 0848a02..913424f 100644
--- a/Apis/api/Controllers/HealthController.cs
+++ b/Apis/api/Controllers/HealthController.cs
@@ -1,5 +1,7 @@
+using System.Reflection;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
+using StartupHelpers;
using Swashbuckle.AspNetCore.Annotations;
namespace Api.Controllers
@@ -14,6 +16,18 @@ namespace Api.Controllers
[EnableCors("FrontendOnly")]
public sealed class HealthController : ControllerBase
{
+ ///
+ /// Returns the deployed API version.
+ ///
+ /// 200 OK with JSON payload: { "version": "1.0.0-build.20250522103045" }
+ // GET api/health/version
+ [HttpGet("version")]
+ [SwaggerOperation(Summary = "API version", Description = "Returns the deployed API assembly version.")]
+ [SwaggerResponse(StatusCodes.Status200OK, "Version returned")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ public IActionResult Version() =>
+ Ok(new { version = StartupExtensions.GetApplicationVersion(Assembly.GetExecutingAssembly()) });
+
///
/// Liveness probe.
/// Indicates whether the process is running. Used by orchestration systems to confirm the process is alive.
diff --git a/web/Dockerfile b/web/Dockerfile
index aa56baf..49d964d 100644
--- a/web/Dockerfile
+++ b/web/Dockerfile
@@ -13,8 +13,6 @@ 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 9e4777b..c14b1dd 100644
--- a/web/Program.cs
+++ b/web/Program.cs
@@ -14,9 +14,6 @@ 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/js/main.js b/web/wwwroot/js/main.js
index 3cd183e..59b0890 100644
--- a/web/wwwroot/js/main.js
+++ b/web/wwwroot/js/main.js
@@ -263,7 +263,7 @@
$('#year').text(new Date().getFullYear());
- $.getJSON('/version').done(function (data) {
+ $.getJSON('/api/health/version').done(function (data) {
if (data && data.version) {
$('#app-version').text('v' + data.version);
}