From b48c3510829f4fa6035848b74277f99764708c17 Mon Sep 17 00:00:00 2001 From: Mark Ettema Date: Sun, 9 May 2021 17:02:36 +0700 Subject: [PATCH] Small restructure Dockerfile --- Dockerfile | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 11e1348..3388020 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,22 @@ FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build + WORKDIR /src -COPY ["src/SteamOpenIdConnectProvider.csproj", "SteamOpenIdConnectProvider/"] -RUN dotnet restore "SteamOpenIdConnectProvider/SteamOpenIdConnectProvider.csproj" -COPY ["src/", "SteamOpenIdConnectProvider/"] -WORKDIR "/src/SteamOpenIdConnectProvider" -RUN dotnet build "SteamOpenIdConnectProvider.csproj" -c Release -o /app + +# Copy the project file to create layer with packages +COPY src/SteamOpenIdConnectProvider.csproj . +RUN dotnet restore ./SteamOpenIdConnectProvider.csproj + +# Copy the rest of the source +COPY src/* . +RUN dotnet build ./SteamOpenIdConnectProvider.csproj -c Release -o /app FROM build AS publish -RUN dotnet publish "SteamOpenIdConnectProvider.csproj" -c Release -o /app +RUN dotnet publish ./SteamOpenIdConnectProvider.csproj -c Release -o /app FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base WORKDIR /app COPY --from=publish /app . EXPOSE 80 + HEALTHCHECK CMD curl --fail http://localhost/health || exit 1 -ENTRYPOINT ["dotnet", "SteamOpenIdConnectProvider.dll"] +ENTRYPOINT ["dotnet", "SteamOpenIdConnectProvider.dll"] \ No newline at end of file