I always use docker to run or publish my applications. It makes life so easy to build, publish and update applications on servers.
I uploaded all example files in to my GitHub Repository.
Use sample code to create .NET Core Web Application
To build an application we only need Source Code, let's ignore unnecessary files like ./obj or ./bin.
We will use Microsoft official SDK and Runtime Docker Containers to Build and Run .NET Core Application. This will make Application Container lighter since it will not include Source Code, only artifacts and libraries etc. Please replace Application name if needed.
Build Docker Container from Dockerfile file in current directory:
docker build -t web-application .
Run built web-application container in detached mode with api name and Port 80 accessible to localhost:
docker run -d -p 80:80 --name api web-application
To test if Application runs, open http://localhost URL in a Web Browser.
docker stop api && docker rm api