Dockerfiles represent a way to create an image w/ a layered file system using 1 or more existing images along w/ steps to build/copy files and dependencies.
Easy way to autogenerate a production ready .dockerfile in VS Code -
- open project folder in vscode
- install both the docker & C# (omnisharp) extensions
- Ctrl+Shift+p => .NET: Generate Assets for build...
- this will generate a .vscode folder w/ a launch.json and tasks.json for the build
- Ctrl+Shift+p => Docker: Add docker files to workspace... select .net core, windows, and what ports are exposed from the container (default is 80, 443). Note: "windows" only works if you're running windows containers in docker (need Windows 10 Pro)
Right-click the dockerfile in vscode and hit "build image..." to have it build the image on your machine for use in a container.
^ Use this method when possible to save time in generating docker file.
- Most issues w/ web apps in containers seem to be port driven when your starting out. Watch what ports your app is running on in the container vs the one it is bound to in the "docker build" command