Implemented health check endpoint and docker health

This commit is contained in:
Mia Rose Winter 2024-02-15 14:51:44 +01:00
parent 52a28edf87
commit f10ffe4e11
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E
2 changed files with 7 additions and 1 deletions

View file

@ -3,11 +3,14 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
RUN mkdir -p /app/files && chown app /app/files RUN mkdir -p /app/files && chown app /app/files
RUN mkdir -p /configuration && chown app /configuration RUN mkdir -p /configuration && chown app /configuration
RUN apt-get update && apt-get install -y curl
USER app USER app
VOLUME /app/files VOLUME /app/files
VOLUME /configuration VOLUME /configuration
WORKDIR /app WORKDIR /app
EXPOSE 8080 EXPOSE 8080
HEALTHCHECK --start-period=5s --start-interval=15s --interval=30s --timeout=30s --retries=3 \
CMD curl --fail http://localhost:8080/health || exit 1
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release ARG BUILD_CONFIGURATION=Release

View file

@ -107,6 +107,7 @@
#region Services #region Services
builder.Services.AddHealthChecks();
builder.Services.AddLocalization(options => { builder.Services.AddLocalization(options => {
options.ResourcesPath = "Resources"; options.ResourcesPath = "Resources";
}); });
@ -171,6 +172,8 @@
// Add additional endpoints required by the Identity /Account Razor components. // Add additional endpoints required by the Identity /Account Razor components.
app.MapAdditionalIdentityEndpoints(); app.MapAdditionalIdentityEndpoints();
app.MapHealthChecks("/health");
app.MapControllers(); app.MapControllers();
app.UseOutputCache(); app.UseOutputCache();