# https://hub.docker.com/_/microsoft-dotnet FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /source # copy csproj and restore as distinct layers COPY *.sln . COPY BlueWest/*.csproj ./BlueWest/ COPY BlueWest.Api/*.csproj ./BlueWest.Api/ COPY BlueWest.Data/*.csproj ./BlueWest.Data/ COPY include/Math-Expression-Evaluator/SimpleExpressionEvaluator/*.csproj ./include/Math-Expression-Evaluator/SimpleExpressionEvaluator/ COPY include/Math-Expression-Evaluator/SimpleExpressionEvaluator.Tests/*.csproj ./include/Math-Expression-Evaluator/SimpleExpressionEvaluator.Tests/ COPY include/MapTo/src/BlueWest.MapTo/*.csproj ./include/MapTo/src/BlueWest.MapTo/ COPY include/MapTo/src/BlueWest.MapTo/MapTo.props ./include/MapTo/src/BlueWest.MapTo/ RUN dotnet restore # copy everything else and build app COPY BlueWest/. ./BlueWest/ WORKDIR /source/BlueWest.Api #RUN dotnet publish -c release -o /app --no-restore RUN mkdir -p xo RUN dotnet publish "BlueWest.Api.csproj" -c Release -o xo --no-restore workdir xo # final stage/image FROM mcr.microsoft.com/dotnet/aspnet:6.0 ENTRYPOINT ["dotnet", "BlueWest.Api.dll"]