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
RUN mkdir -p /app/files && chown app /app/files
RUN mkdir -p /configuration && chown app /configuration
RUN apt-get update && apt-get install -y curl
USER app
VOLUME /app/files
VOLUME /configuration
WORKDIR /app
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
ARG BUILD_CONFIGURATION=Release
@ -25,4 +28,4 @@ RUN dotnet publish "./Wave.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:Us
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Wave.dll"]
ENTRYPOINT ["dotnet", "Wave.dll"]

View file

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