diff --git a/Wave/Dockerfile b/Wave/Dockerfile index 8a81774..def4ec6 100644 --- a/Wave/Dockerfile +++ b/Wave/Dockerfile @@ -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"] \ No newline at end of file +ENTRYPOINT ["dotnet", "Wave.dll"] diff --git a/Wave/Program.cs b/Wave/Program.cs index 52b36a9..c69b652 100644 --- a/Wave/Program.cs +++ b/Wave/Program.cs @@ -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();