- Basics about new project system in ASP.NET Core 1.0
- Running web app with cross-platform web server Kestrel
- Basics about Node.js-based web tools in Visual Studio 2015
- Running ASP.NET Core web apps in a Docker container
- Packaging ASP.NET Core web apps in Docker images using a
Dockerfile
-
Open Sample/AspNetCore1.sln in Visual Studio 2015.
-
Build the solution and make sure that there are no errors.
-
In Visual Studio, look at
project.json
and make yourself familiar with the code. -
Discussion points:
- New project structure (
.xproj
) - New configuration system (JSON instead of XML, options-pattern, etc.)
- Dependency injection in ASP.NET Core 1.0
- Integration of web development tools like NPM, Node.js, Gulp, etc. in Visual Studio
- Code walk-through for Angular 2.0 code
- New project structure (
-
Open a developer command prompt and navigate to the directory
Sample/AspNetCore1
. -
Discussion points:
- Describe basics of ASP.NET Core 1.0 CLI
- Speak about changes from RC1 to RC2 (see also blog article from Shawn Wildermuth)
-
Run
dotnet --help
to make sure ASP.NET Core 1.0 RC2 is installed on your computer. -
Run
dotnet restore
to restore necessary packages from NuGet. -
Run
npm install
to restore necessary NPM packages. -
Run
dotnet run
to start your web app using the cross-platform Kestrel web server.
-
Discussion points:
- Relation of Kestrel and IIS on Windows
-
Open
http://localhost:5000/index.html
to test your web app.
-
Discussion points:
- Short introduction into Docker's basic concepts
- Speak about differences to virtual machines
- Point out that this exercise uses the Docker host created in the previous exercise
-
Use an SSH Client (on Windows e.g. PuTTY) and connect to your the VM you created in exercise 7.
-
Make sure that Docker is up and running using:
docker info
-
Clone the sample repository for this training:
git clone https://github.com/rstropek/PracticalDevOpsTraining.git
-
Get Microsoft's Docker image for ASP.NET Core:
docker pull microsoft/dotnet:latest
-
Start a new interactive Docker container:
docker run -it -p 5000:5000 -v ~/PracticalDevOpsTraining/Sample/AspNetCore1:/src microsoft/dotnet:latest /bin/bash
. This command might take some moments if you run it for the first time. Subsequent calls should be much faster. -
Discussion points:
- Describe concept of volume mappings (
-v
) and port mappings (-p
)
- Describe concept of volume mappings (
-
Inside of the Docker container, navigate to the mounted
src
folder:cd src
-
Restore NuGet packages:
dotnet restore
-
Run our sample in the Docker container:
dotnet run
-
In your browser, open
http://yourvmname.cloudapp.net:5000/api/books
. -
Once you are done, exit from your Docker container using
exit
. -
Look for the container using
docker ps -a
. It should not be stopped. Delete your container usingdocker rm
.
-
Exit from Docker container but stay on Docker VM.
-
Navigate to
PracticalDevOpsTraining/Sample
:cd ~/PracticalDevOpsTraining/Sample
-
Build image from
Dockerfile
:docker build -t myaspnet .
-
Discussion points:
- Speak about basic concepts of Dockerfiles
- Code walk-through for
Dockerfile
-
Run container from image:
docker run -d -p 5000:5000 myaspnet
-
Use
docker ps
anddocker logs
to make sure your container is up and running. -
In your browser, open
http://yourvmname.cloudapp.net:5000/api/books
.