From 92e91de9c286833cf67ee53faec81dd97c66a3e1 Mon Sep 17 00:00:00 2001 From: ThompsonNye Date: Sat, 24 Aug 2024 13:50:03 +0200 Subject: [PATCH] Include healthcheck in Dockerfile --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 73deb8d..2058b2c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ USER app WORKDIR /app EXPOSE 8080 EXPOSE 8081 +RUN apt-get update && apt-get install -y curl FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build ARG BUILD_CONFIGURATION=Release @@ -22,4 +23,5 @@ RUN dotnet publish "./WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p: FROM base AS final WORKDIR /app COPY --from=publish /app/publish . +HEALTHCHECK --interval=20s --timeout=1s --start-period=10s --retries=3 CMD curl --fail http://localhost:8080/health || exit 1 ENTRYPOINT ["dotnet", "WebApi.dll"] \ No newline at end of file