Building .Net apps outside Docker? My company uses Azure DevOps and utilized Pipelines for building, testing and deploying (currently NuGet packages) .Net Framework apps.

My boss has made it clear he wants us to containerize all our microservices and at some point start using Kubernetes. During this process we will also port our apps to .Net Core, one by one.

After I had made a multistage Dockerfile (building and runtime, but not testing yet) for one of our microservices, he suggested we could simplify it by continuing to use Pipelines to build and test the apps and in a later task add the compiled app to a Docker container in Azure DevOps. This seems to be an anti-pattern as far as I know (I may be wrong), and I understand his desire for simplicity.

Is this an anti-pattern or is it a good idea?
I'd say it is an anti-pattern as you lose the portability of Docker.  Now you will be relying on the build server's configuration instead of portable base image.

If reducing complexity of the Dockerfile is the goal why not do something like this:


Build the .net core project in Docker (eliminates reliance on the build server).
Run the tests (inside or outside of Docker).
Now push the image and run it.


Basically break your Dockerfile into three discrete pipeline steps.  This allows the build to fail on a discrete step.  It also reduces the complexity of the Dockerfile (at the cost of increased complexity in your pipeline).