How to Setup ASP.NET Core 2.2 with a Multiple Build Dockerfile

ASP.NET Core, Docker
Now that Docker is becoming a must have when creating small services and needing them to be resilient and easy to deploy, I wanted to create a simple how-to for using ASP.NET Core 2.2 and a Dockerfile with multiple build steps. This tutorial assumes you know how to create an ASP.NET Core 2.2 project but for context on how the Dockerfile is written, here is my project structure. Project - src -- Api --- Api.csproj -- Core --- Core.csproj - Dockerfile Dockerfile FROM microsoft/dotnet:2.2-sdk AS build WORKDIR /src COPY . . RUN dotnet restore RUN dotnet build -c Release --no-restore FROM build AS publish RUN dotnet publish /src/Api/Api.csproj -c Release -o /app --no-restore FROM microsoft/dotnet:2.2-aspnetcore-runtime WORKDIR /src COPY --from=publish /app . ENTRYPOINT [ "dotnet", "Api.dll"] Walkthrough The Dockerfile is short…
Read More