Building .Net apps outside Docker?
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).