Basic docker template for ASP.NET Core app
1 min readOct 6, 2019
I just added this gist to remind myself what a very basic docker file looks like that can be used for asp.net core apps that use single-page app frontends (angular, vue, etc).
Full gist:
Couple things to note:
- an app is built inside a temporary container first, you can skip this if you build it locally
- uses alpine images to keep the image sizes small
- note node/npm installation, without it you will encounter errors during publish step
- there are some assumptions made about where your source is, “./src/web”. Adjust that path if your web project is located somewhere else
- adjust entry point if your output dll is different
Copy step for building could take a while if you have done the builds locally (due to bin/obj and node_modules directories). Having .dockerignore in your repo could speed this up significantly: