I’ve been building .NET Core Web API micro-services for a while now and have been loving it. However, when it came to Docker image size, it did not hold a candle to a Golang API using a SCRATCH base image. Some of my production images that are written in .NET Core 2.0 were typically coming in around 200–300MB. While Go is fast and compiles down amazingly well, I find that the language and tooling leaves a bit to be desired and sometimes I still long for Visual Studio and all its syntactic sugar. With the release of .NET Core 3.1 LTS last year, I decided it was finally time to revisit using it to build a tiny WebAPI container.
There were a few requirements on this journey. These are goals I set for myself in order to push the limits of .NET Core during this experiment.
Let’s get started with building out a base .NET Core WebAPI in Visual Studio. We’ll use the “New Project” wizard and select “API” from the “.NET Core App” left hand nav.
#dotnet-core #docker #docker container #.net core 3.1 #linux