diff --git a/wikidata_service/Dockerfile b/wikidata_service/Dockerfile index 8e01f1f..3958188 100644 --- a/wikidata_service/Dockerfile +++ b/wikidata_service/Dockerfile @@ -1,17 +1,22 @@ -# Use the official image as a parent image. -FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app +EXPOSE 80 +EXPOSE 443 -# Copy csproj and restore as distinct layers -COPY *.csproj ./ -RUN dotnet restore +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["WikiDataTest/WikiDataTest.csproj", "WikiDataTest/"] +RUN dotnet restore "./WikiDataTest/./WikiDataTest.csproj" +COPY . . +WORKDIR "/src/WikiDataTest" +RUN dotnet build "./WikiDataTest.csproj" -c %BUILD_CONFIGURATION% -o /app/build -# Copy everything else and build -COPY . ./ -RUN dotnet publish -c Release -o out +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./WikiDataTest.csproj" -c %BUILD_CONFIGURATION% -o /app/publish /p:UseAppHost=false -# Build runtime image -FROM mcr.microsoft.com/dotnet/aspnet:6.0 +FROM base AS final WORKDIR /app -COPY --from=build-env /app/out . +COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "WikiDataTest.dll"] \ No newline at end of file