Skip to content

Commit

Permalink
Editing quick fixes for latest sample app tutorial. (MicrosoftDocs#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Wilhite authored Aug 4, 2017
1 parent 1cbc3a1 commit 4f5b9f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ The exercise will walk you through taking a sample ASP.net app and converting it

This quick start is specific to Windows 10. Additional quick start documentation can be found in the table of contents on the left hand side of this page. Since the focus of this tutorial concerns containers, we will forego writing code and focus solely on containers. If you want to build the tutorial from the ground up, then you can find it in [ASP.NET Core Documentation](https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app-xplat/)

If you don't have Git source control installed on your computer, you can grab it here: [Git](https://git-scm.com/download)

## Getting Started

This sample project was set up with [VSCode](https://code.visualstudio.com/). We will also be using Powershell. Let's grab the demo code from github. You can clone the repo with git or download the project directly from [SampleASPContainerApp](https://github.com/cwilhit/SampleASPContainerApp).

```Bash
```Powershell
git clone https://github.com/cwilhit/SampleASPContainerApp.git
```

Now, let's navigate to the project directory and create the Dockerfile.
Now, let's navigate to the project directory and create the Dockerfile. A [Dockerfile](https://docs.docker.com/engine/reference/builder/) is like a makefile--a list of instructions that describe how a container image must be built.

```Powershell
#Create the dockerfile for our proj
Expand Down Expand Up @@ -86,6 +88,8 @@ COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "MvcMovie.dll"]
```

We have now successfully performed what is called a _multi-stage build_. We used the temporary container to build our image and then moved over the published dll into another container so that we minimized the footprint of the end result. We want this container to have the absolute minimum required dependencies to run; if we had kept with using our first image, then it would have come packaged with other layers (for building ASP.NET apps) which were not vital and therefore would increase our image size.

## Running the App

Now that the dockerfile is written, all that is left to do is tell docker to build our app and then run the container. We specify the port to publish to and then give our container a tag "myapp". In powershell, execute these commands:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,6 @@ docker pull <user>/iis-dockerfile

## Next Steps

If you would like to see how to package a sample ASP.NET application, visit the Windows 10 tutorials linked below.

[Windows Containers on Windows 10](./quick-start-windows-10.md)

0 comments on commit 4f5b9f7

Please sign in to comment.