diff --git a/Dockerfile b/Dockerfile index aa637a5..e16d859 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,5 +14,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:latest WORKDIR /app COPY --from=build-env /app/out . +RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/* EXPOSE 8080 +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 CMD curl -f http://localhost:8080/healthz || exit 1 ENTRYPOINT ["dotnet", "SDMetaUI.dll"] \ No newline at end of file diff --git a/SDMetaUI/Program.cs b/SDMetaUI/Program.cs index 8c285bc..e38d3ec 100644 --- a/SDMetaUI/Program.cs +++ b/SDMetaUI/Program.cs @@ -30,6 +30,7 @@ builder.Services.AddServerSideBlazor(); AddCustomServices(builder); builder.Services.AddControllers(); +builder.Services.AddHealthChecks(); var app = builder.Build(); @@ -45,6 +46,7 @@ app.MapGet("/images/thumb/{path:required}", ImagesController.GetThumb); app.MapGet("/images/full/{path:required}/{realfilename}", ImagesController.GetFull); +app.MapHealthChecks("/healthz"); // https://github.com/gmanvel/AspNetCoreSingleFileApp app.UseStaticFiles(new StaticFileOptions