├── .gitignore ├── DockerComposeWindows.md ├── HelloWindowsContainers.md ├── Images ├── Part1 │ ├── SetupEnvironment1.jpg │ ├── SetupEnvironmentAzure1.png │ ├── SetupEnvironmentAzure10.jpg │ ├── SetupEnvironmentAzure2.jpg │ ├── SetupEnvironmentAzure3.png │ ├── SetupEnvironmentAzure4.jpg │ ├── SetupEnvironmentAzure5.png │ ├── SetupEnvironmentAzure6.jpg │ ├── SetupEnvironmentAzure7.jpg │ ├── SetupEnvironmentAzure8.png │ └── SetupEnvironmentAzure9.jpg ├── Part2 │ ├── HelloWindowsContainers1.jpg │ ├── HelloWindowsContainers2.jpg │ └── HelloWindowsContainers3.jpg └── Part3 │ ├── DockerBuild.PNG │ ├── DockerComposeUp.PNG │ ├── DockerComposeUp2.PNG │ ├── DockerImages.PNG │ ├── DockerLogin.PNG │ ├── DockerPush.PNG │ ├── ItWorks.PNG │ ├── VSCode.png │ └── VSCodeProject.PNG ├── README.md ├── SetupEnvironment.md └── Sources ├── ProductsApi ├── .dockerignore ├── .gitignore ├── Controllers │ └── ProductsController.cs ├── Dockerfile.Nano ├── Dockerfile.WSCore ├── Program.cs ├── Properties │ └── launchSettings.json ├── README.md ├── Startup.cs ├── appsettings.json ├── project.json └── web.config ├── RatingsApi ├── .dockerignore ├── .gitignore ├── Controllers │ └── RatingsController.cs ├── Dockerfile.Nano ├── Dockerfile.WSCore ├── Program.cs ├── Properties │ └── launchSettings.json ├── README.md ├── Startup.cs ├── appsettings.json ├── project.json └── web.config ├── ShopFront ├── .bowerrc ├── .dockerignore ├── .gitignore ├── Controllers │ └── HomeController.cs ├── Dockerfile.Nano ├── Dockerfile.WSCore ├── Models │ └── Settings.cs ├── Program.cs ├── Properties │ └── launchSettings.json ├── README.md ├── Startup.cs ├── Views │ ├── Home │ │ └── Index.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ └── _Layout.cshtml │ ├── _ViewImports.cshtml │ └── _ViewStart.cshtml ├── appsettings.json ├── bower.json ├── bundleconfig.json ├── project.json ├── web.config └── wwwroot │ ├── css │ ├── site.css │ └── site.min.css │ ├── favicon.ico │ ├── images │ ├── banner1.svg │ ├── banner2.svg │ ├── banner3.svg │ └── banner4.svg │ └── js │ └── site.js ├── docker-compose-nanoserver.yml └── docker-compose-windowsservercore.yml /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | *.VC.VC.opendb 85 | 86 | # Visual Studio profiler 87 | *.psess 88 | *.vsp 89 | *.vspx 90 | *.sap 91 | 92 | # TFS 2012 Local Workspace 93 | $tf/ 94 | 95 | # Guidance Automation Toolkit 96 | *.gpState 97 | 98 | # ReSharper is a .NET coding add-in 99 | _ReSharper*/ 100 | *.[Rr]e[Ss]harper 101 | *.DotSettings.user 102 | 103 | # JustCode is a .NET coding add-in 104 | .JustCode 105 | 106 | # TeamCity is a build add-in 107 | _TeamCity* 108 | 109 | # DotCover is a Code Coverage Tool 110 | *.dotCover 111 | 112 | # NCrunch 113 | _NCrunch_* 114 | .*crunch*.local.xml 115 | nCrunchTemp_* 116 | 117 | # MightyMoose 118 | *.mm.* 119 | AutoTest.Net/ 120 | 121 | # Web workbench (sass) 122 | .sass-cache/ 123 | 124 | # Installshield output folder 125 | [Ee]xpress/ 126 | 127 | # DocProject is a documentation generator add-in 128 | DocProject/buildhelp/ 129 | DocProject/Help/*.HxT 130 | DocProject/Help/*.HxC 131 | DocProject/Help/*.hhc 132 | DocProject/Help/*.hhk 133 | DocProject/Help/*.hhp 134 | DocProject/Help/Html2 135 | DocProject/Help/html 136 | 137 | # Click-Once directory 138 | publish/ 139 | 140 | # Publish Web Output 141 | *.[Pp]ublish.xml 142 | *.azurePubxml 143 | # TODO: Comment the next line if you want to checkin your web deploy settings 144 | # but database connection strings (with potential passwords) will be unencrypted 145 | *.pubxml 146 | *.publishproj 147 | 148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 149 | # checkin your Azure Web App publish settings, but sensitive information contained 150 | # in these scripts will be unencrypted 151 | PublishScripts/ 152 | 153 | # NuGet Packages 154 | *.nupkg 155 | # The packages folder can be ignored because of Package Restore 156 | **/packages/* 157 | # except build/, which is used as an MSBuild target. 158 | !**/packages/build/ 159 | # Uncomment if necessary however generally it will be regenerated when needed 160 | #!**/packages/repositories.config 161 | # NuGet v3's project.json files produces more ignoreable files 162 | *.nuget.props 163 | *.nuget.targets 164 | 165 | # Microsoft Azure Build Output 166 | csx/ 167 | *.build.csdef 168 | 169 | # Microsoft Azure Emulator 170 | ecf/ 171 | rcf/ 172 | 173 | # Windows Store app package directories and files 174 | AppPackages/ 175 | BundleArtifacts/ 176 | Package.StoreAssociation.xml 177 | _pkginfo.txt 178 | 179 | # Visual Studio cache files 180 | # files ending in .cache can be ignored 181 | *.[Cc]ache 182 | # but keep track of directories ending in .cache 183 | !*.[Cc]ache/ 184 | 185 | # Others 186 | ClientBin/ 187 | ~$* 188 | *~ 189 | *.dbmdl 190 | *.dbproj.schemaview 191 | *.pfx 192 | *.publishsettings 193 | node_modules/ 194 | orleans.codegen.cs 195 | 196 | # Since there are multiple workflows, uncomment next line to ignore bower_components 197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 198 | #bower_components/ 199 | 200 | # RIA/Silverlight projects 201 | Generated_Code/ 202 | 203 | # Backup & report files from converting an old project file 204 | # to a newer Visual Studio version. Backup files are not needed, 205 | # because we have git ;-) 206 | _UpgradeReport_Files/ 207 | Backup*/ 208 | UpgradeLog*.XML 209 | UpgradeLog*.htm 210 | 211 | # SQL Server files 212 | *.mdf 213 | *.ldf 214 | 215 | # Business Intelligence projects 216 | *.rdl.data 217 | *.bim.layout 218 | *.bim_*.settings 219 | 220 | # Microsoft Fakes 221 | FakesAssemblies/ 222 | 223 | # GhostDoc plugin setting file 224 | *.GhostDoc.xml 225 | 226 | # Node.js Tools for Visual Studio 227 | .ntvs_analysis.dat 228 | 229 | # Visual Studio 6 build log 230 | *.plg 231 | 232 | # Visual Studio 6 workspace options file 233 | *.opt 234 | 235 | # Visual Studio LightSwitch build output 236 | **/*.HTMLClient/GeneratedArtifacts 237 | **/*.DesktopClient/GeneratedArtifacts 238 | **/*.DesktopClient/ModelManifest.xml 239 | **/*.Server/GeneratedArtifacts 240 | **/*.Server/ModelManifest.xml 241 | _Pvt_Extensions 242 | 243 | # Paket dependency manager 244 | .paket/paket.exe 245 | paket-files/ 246 | 247 | # FAKE - F# Make 248 | .fake/ 249 | 250 | # JetBrains Rider 251 | .idea/ 252 | *.sln.iml 253 | 254 | **/*/wwwroot/lib 255 | **/*/*.min.js -------------------------------------------------------------------------------- /DockerComposeWindows.md: -------------------------------------------------------------------------------- 1 | # Part 3 - Deploy a multi-containers application on Windows 2 | 3 | In this part, you will learn how to use Docker and Docker Compose to deploy a multi-containers application on Windows. 4 | [Go back to the HOL home page.](https://github.com/jcorioland/WindowsContainersHOL) 5 | 6 | ## Introduction 7 | 8 | The application that you are going to deploy within Windows Containers is pretty simple as it is composed of three components, all developed using [ASP.NET Core 1.0](https://github.com/aspnet): 9 | 10 | - Web Front: a simple web application that makes AJAX calls the three other APIs and display their results on the home page 11 | - Products Api : a simple rest API that returns a message with its version and the hostname where it is currently executed 12 | - Ratings Api : a simple rest API that returns a message with its version and the hostname where it is currently executed 13 | 14 | All the source code for this application can be found in the [Sources](https://github.com/jcorioland/WindowsContainersHOL/tree/master/Sources) folder of this repository. 15 | You can use any text editor to visualize the sources or you can install [Visual Studio Code](https://code.visualstudio.com) (available on Linux, macOS or Windows) to be able to work with this source code. 16 | 17 | First, clone this repository using the following command: 18 | 19 | ``` 20 | git clone https://github.com/jcorioland/WindowsContainersHOL.git 21 | ``` 22 | 23 | The project is quite simple: 24 | 25 | - The ProductsApi folder contains the code for the Products web Api 26 | - The RatingsApi folder contains the code for the Ratings web Api 27 | - The ShopFront folder contains the code for the web application 28 | 29 | ## Build your first Docker image 30 | 31 | When working with Docker on Linux, you can create a container from an image that has been built by someone and that has been pushed into the [Docker Hub](hub.docker.com/) or in a [Docker Trusted Registry](https://docs.docker.com/docker-trusted-registry/), for private applications. It is exactly the same for Windows Containers image with Docker. 32 | 33 | You can also [build your own image](https://docs.docker.com/engine/tutorials/dockerimages/), from an existing container using the **docker commit** command or from a Dockerfile, which is like a receipt file that contains all the instructions to configure and install the application you want to run in a container. 34 | 35 | The basic DevOps workflow when working with Docker is: 36 | 37 | 1. The developer develops the application 38 | 2. The developer creates a Dockerfile that describes how to install the application and its dependencies 39 | 3. The developer builds a Docker image from the Dockerfile using the **docker build** command 40 | 4. The developer pushes the image into a registry, public or private 41 | 5. The ops guy pull the image from the registry 42 | 6. The ops guy run the container from the image 43 | 7. The ops guy operate / monitor the application 44 | 45 | As there are two different images for Windows Server Containers, you can choose to build your images based on Windows Server Core or Nano Server (which is smaller). In each project's folder, you will see two Dockerfile, one for Windows Server Core and one for Nano Server. 46 | 47 | Open a PowerShell session and go to the ProductsApi directory. Then you can build the products API image using: 48 | 49 | ``` 50 | docker build -t products-api -f Dockerfile.Nano . 51 | ``` 52 | 53 | Then, go to the RatingsApi folder and build the ratings API image: 54 | 55 | ``` 56 | docker build -t ratings-api -f Dockerfile.Nano . 57 | ``` 58 | 59 | And finally, do the same for the web front, in the ShopFront directory: 60 | 61 | ``` 62 | docker build -t shop-front -f Dockerfile.Nano . 63 | ``` 64 | 65 | Note : if you want build image based on Windows Server Core, just use the Dockerfile.WSCore instead of the Dockerfile.Nano. 66 | 67 | ## Create a Docker Hub account 68 | 69 | If you do not already have a Docker Hub account, please go to https://hub.docker.com and create a new one, it's free! 70 | 71 | ## Tag and push your images to the Docker Hub 72 | 73 | To be able to push the image into your Docker Hub account, its name needs to start by your Docker Hub identifier. For example, my identifier is jcorioland, so all images I want to push in the hub should start with jcorioland/IMAGE_NAME. 74 | You can also add tag to an image, to version it and be able to push multiple versions of one container image. 75 | 76 | You can use the **docker tag** command to add a tag to the images you have built in the previous steps. 77 | 78 | ``` 79 | docker tag products-api YOUR_DOCKER_HUB_IDENTIFIER/products-api:1.0.0-preview2-nanoserver 80 | ``` 81 | 82 | Repeat this operation for all the images. 83 | 84 | Now you can do a **docker login** and enter your Docker Hub credentials once prompted. 85 | 86 | ![DockerBuild] 87 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part3/DockerLogin.PNG) 88 | 89 | As soon as you are successfuly logged in you can use the **docker push** command to push each images in your Docker Hub account: 90 | 91 | ``` 92 | docker push YOUR_DOCKER_HUB_IDENTIFIER/products-api:1.0.0-preview2-nanoserver 93 | ``` 94 | 95 | ![DockerPush] 96 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part3/DockerPush.PNG) 97 | 98 | ## Use Docker-Compose to start your application 99 | 100 | Docker Compose is a CLI tool that allows to start multiple containers at the same time. In this example, we want to launch 3 containers, one for each component of the application. 101 | 102 | If you look at the root of the Sources directory, you will see a docker-compose.yml file. This file defines the different services that will compose the application: 103 | 104 | ``` 105 | version: '2' 106 | networks: 107 | nat: 108 | external: true 109 | 110 | services: 111 | products-service: 112 | image: jcorioland/products-api:1.0.0-preview2-nanoserver 113 | ports: 114 | - "5001:5001" 115 | networks: 116 | nat: 117 | ipv4_address: 172.26.127.31 118 | ratings-service: 119 | image: jcorioland/ratings-api:1.0.0-preview2-nanoserver 120 | ports: 121 | - "5002:5002" 122 | networks: 123 | nat: 124 | ipv4_address: 172.26.127.32 125 | shop-front: 126 | image: jcorioland/shop-front:1.0.0-preview2-nanoserver 127 | ports: 128 | - "5000:5000" 129 | networks: 130 | nat: 131 | ipv4_address: 172.26.127.30 132 | environment: 133 | - SHOP_PRODUCTS_API_URL=http://172.26.127.31:5001 134 | - SHOP_RATINGS_API_URL=http://172.26.127.32:5002 135 | ``` 136 | 137 | All you need to do here is to replace the image name of each component by the names of your images. And then start the application using the following command: 138 | 139 | ``` 140 | docker-compose -f docker-compose-nanoserver.yml up 141 | ``` 142 | 143 | This will create three containers: 144 | 145 | ![DockerComposeUp] 146 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part3/DockerComposeUp.PNG) 147 | 148 | Wait a minute to be sure that all applications are started in the containers: 149 | 150 | ![DockerComposeUp2] 151 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part3/DockerComposeUp2.PNG) 152 | 153 | And then browse http://172.26.127.30:5000 on the machine you have started the containers: 154 | 155 | ![ItWorks] 156 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part3/ItWorks.PNG) 157 | 158 | Et voilà! You have completed the part 3 of this Hands-on-Lab. 159 | -------------------------------------------------------------------------------- /HelloWindowsContainers.md: -------------------------------------------------------------------------------- 1 | # Part 2 - Hello Windows Containers ! 2 | 3 | In this part, you will use the Docker command line to run basic operations like running and managing Windows Containers. 4 | [Go back to the HOL home page.](https://github.com/jcorioland/WindowsContainersHOL) 5 | 6 | In the [Part 1](https://github.com/jcorioland/WindowsContainersHOL/blob/master/SetupEnvironment.md) you have learned how to configure your environment to be able to work with Windows Containers. 7 | 8 | Windows Containers can be used from the [Docker CLI](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiesdTjxPXPAhXrLsAKHQY3DjQQFggeMAA&url=https%3A%2F%2Fdocs.docker.com%2Fengine%2Freference%2Fcommandline%2Fcli%2F&usg=AFQjCNFUtcaiFc4UMmGUNXGn4cPMy4cCmg&sig2=15m0mF2jKo0KvqnT1LzwiA). To get started, open an elevated PowerShell session on the machine you have configured in the previous step and type the following command: 9 | 10 | ```PowerShell 11 | docker run -it microsoft/windowsservercore cmd 12 | ``` 13 | 14 | This command will start a new container using the Windows Server Core base image and start cmd.exe within the container. The -it option allows to start the container in interactive mode so you can be connected within the container and use CMD from the inside: 15 | 16 | ![HelloWindowsContainers1] 17 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part2/HelloWindowsContainers1.jpg) 18 | 19 | If you start another PowerShell window and type **docker ps** you will see that a container is running: 20 | 21 | ![HelloWindowsContainers2] 22 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part2/HelloWindowsContainers2.jpg) 23 | 24 | Depending on whether you are running the previous command on Windows Server 2016 or Windows 10, you are not working with the same kind of Windows Containers. 25 | 26 | Actually, there are two types of Windows Containers: 27 | 28 | - Windows Server Containers, that are similar than Linux containers in the concepts 29 | - Hyper-V Containers, that runs inside a small virtual machine on Hyper-V 30 | 31 | ![HelloWindowsContainers3] 32 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part2/HelloWindowsContainers3.jpg) 33 | 34 | Windows Server Containers share the same base OS and kernel. Hyper-V containers have been designed to be more isolated that Windows Server Containers and are running directly on the hypervisor. They are not sharing the guest OS nor the kernel. 35 | When running on Windows 10, you can only work with Hyper-V containers. 36 | When running on Windows Server 2016, you can choose between Hyper-V and Windows Server containers. By default, when you use the **docker run** command it will start a Windows Server container, but you can specify that you want to run an Hyper-V container by using the flag **--isolation=hyperv** 37 | 38 | Of course, you can use all the commands from the Docker CLI with Windows Containers. For example, you can get the execution logs using the **docker logs** command or get the details about a container using the **docker inspect** command. 39 | 40 | All the tools to build, push and pull Docker images are also available with Docker containers on Windows. You will learn to work with these tools in the [Part 3](https://github.com/jcorioland/WindowsContainersHOL/blob/master/DockerComposeWindows.md). -------------------------------------------------------------------------------- /Images/Part1/SetupEnvironment1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part1/SetupEnvironment1.jpg -------------------------------------------------------------------------------- /Images/Part1/SetupEnvironmentAzure1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part1/SetupEnvironmentAzure1.png -------------------------------------------------------------------------------- /Images/Part1/SetupEnvironmentAzure10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part1/SetupEnvironmentAzure10.jpg -------------------------------------------------------------------------------- /Images/Part1/SetupEnvironmentAzure2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part1/SetupEnvironmentAzure2.jpg -------------------------------------------------------------------------------- /Images/Part1/SetupEnvironmentAzure3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part1/SetupEnvironmentAzure3.png -------------------------------------------------------------------------------- /Images/Part1/SetupEnvironmentAzure4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part1/SetupEnvironmentAzure4.jpg -------------------------------------------------------------------------------- /Images/Part1/SetupEnvironmentAzure5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part1/SetupEnvironmentAzure5.png -------------------------------------------------------------------------------- /Images/Part1/SetupEnvironmentAzure6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part1/SetupEnvironmentAzure6.jpg -------------------------------------------------------------------------------- /Images/Part1/SetupEnvironmentAzure7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part1/SetupEnvironmentAzure7.jpg -------------------------------------------------------------------------------- /Images/Part1/SetupEnvironmentAzure8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part1/SetupEnvironmentAzure8.png -------------------------------------------------------------------------------- /Images/Part1/SetupEnvironmentAzure9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part1/SetupEnvironmentAzure9.jpg -------------------------------------------------------------------------------- /Images/Part2/HelloWindowsContainers1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part2/HelloWindowsContainers1.jpg -------------------------------------------------------------------------------- /Images/Part2/HelloWindowsContainers2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part2/HelloWindowsContainers2.jpg -------------------------------------------------------------------------------- /Images/Part2/HelloWindowsContainers3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part2/HelloWindowsContainers3.jpg -------------------------------------------------------------------------------- /Images/Part3/DockerBuild.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part3/DockerBuild.PNG -------------------------------------------------------------------------------- /Images/Part3/DockerComposeUp.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part3/DockerComposeUp.PNG -------------------------------------------------------------------------------- /Images/Part3/DockerComposeUp2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part3/DockerComposeUp2.PNG -------------------------------------------------------------------------------- /Images/Part3/DockerImages.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part3/DockerImages.PNG -------------------------------------------------------------------------------- /Images/Part3/DockerLogin.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part3/DockerLogin.PNG -------------------------------------------------------------------------------- /Images/Part3/DockerPush.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part3/DockerPush.PNG -------------------------------------------------------------------------------- /Images/Part3/ItWorks.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part3/ItWorks.PNG -------------------------------------------------------------------------------- /Images/Part3/VSCode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part3/VSCode.png -------------------------------------------------------------------------------- /Images/Part3/VSCodeProject.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Images/Part3/VSCodeProject.PNG -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Windows Containers HOL 2 | 3 | ## Introduction 4 | This repo contains labs to help you to get started with Windows Containers & Docker. 5 | 6 | You will discover how to install and use Windows Containers on both Windows Server 2016 or Windows 10 and how to use Docker to work with these containers. 7 | 8 | ## Part 1 - Setup your environment 9 | In this part, you will learn how to setup Windows Server 2016 or Windows 10 to work with Windows Containers and Docker. 10 | [Go to this part.](https://github.com/jcorioland/WindowsContainersHOL/blob/master/SetupEnvironment.md) 11 | 12 | ## Part 2 - Hello Windows Containers ! 13 | In this part, you will use the Docker command line to run basic operations like running and managing Windows Containers. 14 | [Go to this part.](https://github.com/jcorioland/WindowsContainersHOL/blob/master/HelloWindowsContainers.md) 15 | 16 | ## Part 3 - Deploy a multi-containers application on Windows 17 | In this part, you will learn how to use Docker and Docker Compose to deploy a multi-containers application on Windows. 18 | [Go to this part.](https://github.com/jcorioland/WindowsContainersHOL/blob/master/DockerComposeWindows.md) 19 | 20 | ## External 21 | 22 | Here are some external links that could be useful to get more information about Windows Containers: 23 | - [Windows Containers Overview](https://msdn.microsoft.com/en-us/virtualization/windowscontainers/about/about_overview) 24 | - [Get started with Docker for Windows](https://docs.docker.com/docker-for-windows/) 25 | - [Introducing Docker for Windows Server 2016](https://blog.docker.com/2016/09/dockerforws2016/) 26 | - [Windows Containers on Windows Server Quick Start](https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/quick_start_windows_server) 27 | - [Windows Containers on Windows 10 Quick Start](https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/quick_start_windows_10) 28 | - [Hyper-V Containers](https://msdn.microsoft.com/en-us/virtualization/windowscontainers/management/hyperv_container) 29 | - [Windows and .NET Tutorials](https://github.com/docker/labs/tree/master/windows) 30 | -------------------------------------------------------------------------------- /SetupEnvironment.md: -------------------------------------------------------------------------------- 1 | # Part 1 - Setup your environment 2 | 3 | In this part, you will learn how to setup Windows Server 2016 or Windows 10 to work with Windows Containers and Docker. 4 | [Go back to the HOL home page.](https://github.com/jcorioland/WindowsContainersHOL) 5 | 6 | ## Introduction 7 | 8 | Windows Containers are available on Windows Server 2016 and Windows 10 Anniversary Update. There are several ways to get your environment ready. 9 | 10 | ## Windows 10 Anniversary Update 11 | 12 | The simple way to install and configure Windows Container features on your Windows 10 Anniversary Update machine is to download [Docker for Windows](https://docs.docker.com/docker-for-windows/). You need to work with the beta channel to get the support of Windows Container with Docker for Windows. 13 | 14 | If you do not want use Docker for Windows, open an elevated PowerShell session and follow these steps: 15 | 16 | 1. Enable the containers feature on your machine: 17 | 18 | ```PowerShell 19 | Enable-WindowsOptionalFeature -Online -FeatureName containers -All 20 | ``` 21 | 22 | 2. Enable the Hyper-V feature on your machine: 23 | 24 | ```PowerShell 25 | Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All 26 | ``` 27 | 28 | 3. Restart your computer: 29 | 30 | ```PowerShell 31 | Restart-Computer -Force 32 | ``` 33 | Once restarted, re-open an elevated PowerShell session and install Docker using the following commands. 34 | 35 | 4. Download Docker: 36 | 37 | ```PowerShell 38 | Invoke-WebRequest “https://master.dockerproject.org/windows/amd64/docker-1.13.0-dev.zip” -OutFile “$env:TEMP\docker-1.13.0-dev.zip” -UseBasicParsing 39 | ``` 40 | 41 | 5. Expand the Docker archive: 42 | 43 | ```PowerShell 44 | Expand-Archive -Path “$env:TEMP\docker-1.13.0-dev.zip” -DestinationPath $env:ProgramFiles 45 | ``` 46 | 47 | 6. Add the Docker directory in system path: 48 | 49 | ```PowerShell 50 | [Environment]::SetEnvironmentVariable(“Path”, $env:Path + “;C:\Program Files\Docker”, [EnvironmentVariableTarget]::Machine) 51 | ``` 52 | 53 | 7. Register the Docker deamon as a service on your machine: 54 | 55 | ```PowerShell 56 | dockerd --register-service 57 | ``` 58 | 59 | 8. Start the Docker service: 60 | 61 | ```PowerShell 62 | Start-Service Docker 63 | ``` 64 | 65 | After this step, you should be able to work with Docker on your machine. You can type docker info to check that all is good. 66 | 67 | ![PSResult] 68 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part1/SetupEnvironment1.jpg) 69 | 70 | ## Windows Server 2016 71 | 72 | Docker for Windows does not work on Windows Server 2016, so you need to install the containers feature by yourself, but it’s really simple. 73 | 74 | Open an elevated PowerShell session and follow these steps: 75 | 76 | 1. Install the containers feature 77 | 78 | ```PowerShell 79 | Install-WindowsFeature containers 80 | ``` 81 | 82 | 2. Restart the machine 83 | 84 | ```PowerShell 85 | Restart-Computer -Force 86 | ``` 87 | 88 | Once restarted, re-open an elevated PowerShell session and install Docker. 89 | 90 | 3. Download the Docker engine 91 | 92 | ```PowerShell 93 | Invoke-WebRequest “https://download.docker.com/components/engine/windows-server/cs-1.12/docker-1.12.2.zip” -OutFile “$env:TEMP\docker.zip” -UseBasicParsing 94 | ``` 95 | 96 | 4. Install the Docker engine 97 | 98 | ```PowerShell 99 | Expand-Archive -Path “$env:TEMP\docker.zip” -DestinationPath $env:ProgramFiles 100 | ``` 101 | 102 | 5. Add the Docker directory in the system path 103 | 104 | ```PowerShell 105 | [Environment]::SetEnvironmentVariable(“Path”, $env:Path + “;C:\Program Files\Docker”, [EnvironmentVariableTarget]::Machine) 106 | ``` 107 | 108 | 6. Register the Docker deamon as a service 109 | 110 | ```PowerShell 111 | dockerd.exe –register-service 112 | ``` 113 | 114 | 7. Start the Docker service 115 | ```PowerShell 116 | Start-Service Docker 117 | ``` 118 | 119 | After this step, you should be able to work with Docker on your machine. You can type **docker info** to check that all is good. 120 | 121 | ## Windows Server 2016 with Containers on Azure 122 | 123 | If you do not want install and configure yourself Windows Server 2016 and the containers features, the best and quick way to get started is to use the Windows Server 2016 Datacenter with Containers image available in the Microsoft Azure Marketplace. You don’t have a Microsoft Azure account yet? Create one and try Azure for free now from [http://aka.ms/tryazure](http://aka.ms/tryazure). 124 | 125 | Sign in to your Azure account on [http://portal.azure.com](http://portal.azure.com) and search for Windows Server 2016. In the list, you will find the image “with Containers”: 126 | 127 | ![Step1] 128 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part1/SetupEnvironmentAzure1.png) 129 | 130 | Click on this image in the results list: 131 | 132 | ![Step2] 133 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part1/SetupEnvironmentAzure2.jpg) 134 | 135 | Then click on Create to start the creation wizard: 136 | 137 | ![Step3] 138 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part1/SetupEnvironmentAzure3.png) 139 | 140 | Configure the basic settings of your new virtual machine: name, type of disk, username, password and the region where you want to deploy this machine. 141 | 142 | ![Step4] 143 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part1/SetupEnvironmentAzure4.jpg) 144 | 145 | Then click OK and choose the size of the virtual machine. Click OK when you have made your choice. 146 | In the next step, the only mandatory option is the network. Click on the Virtual Network option and click Create New: 147 | 148 | ![Step5] 149 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part1/SetupEnvironmentAzure5.png) 150 | 151 | Give a name to your network and the address space / range you want to work with. Click OK to validate. 152 | Now, you should be able to validate the step 3 and click OK to start the deployment once the validation step completed: 153 | 154 | ![Step6] 155 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part1/SetupEnvironmentAzure6.jpg) 156 | 157 | Wait for the deployment to be completed: 158 | 159 | ![Step7] 160 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part1/SetupEnvironmentAzure7.jpg) 161 | 162 | Once deployed, click on the “Connect” button in the virtual machine general overview: 163 | 164 | ![Step8] 165 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part1/SetupEnvironmentAzure8.png) 166 | 167 | It will launch an RDP session. Use your credentials to start a session. Open PowerShell and start the docker service using the following command: 168 | 169 | ```PowerShell 170 | Start-Service Docker 171 | ``` 172 | 173 | Once started, type **docker info** to validate that all is working as expected. 174 | 175 | ![Step9] 176 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part1/SetupEnvironmentAzure9.jpg) 177 | 178 | ## Pull the base container Images 179 | 180 | Now that you have a machine configured to work with Docker and Windows Containers you need to pull a base image. 181 | There are two base images available: [Windows Server Core](https://hub.docker.com/r/microsoft/windowsservercore/) and [Nano Server](https://hub.docker.com/r/microsoft/nanoserver/). 182 | 183 | ```PowerShell 184 | docker pull microsoft/windowsservercore 185 | ``` 186 | 187 | ```PowerShell 188 | docker pull microsoft/nanoserver 189 | ``` 190 | 191 | NB: if you have deployed the pre-configured virtual machine in Azure, the two base images are already pulled. 192 | 193 | Once completed, you can type **docker images** to check that the images are available on your machine: 194 | 195 | ![Step10] 196 | (https://github.com/jcorioland/WindowsContainersHOL/blob/master/Images/Part1/SetupEnvironmentAzure10.jpg) 197 | 198 | Your environment is now configured. You can go to the [Part 2](https://github.com/jcorioland/WindowsContainersHOL/blob/master/HelloWindowsContainers.md) that will help you to discover Windows Containers! 199 | -------------------------------------------------------------------------------- /Sources/ProductsApi/.dockerignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | obj/ -------------------------------------------------------------------------------- /Sources/ProductsApi/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | 84 | # Visual Studio profiler 85 | *.psess 86 | *.vsp 87 | *.vspx 88 | *.sap 89 | 90 | # TFS 2012 Local Workspace 91 | $tf/ 92 | 93 | # Guidance Automation Toolkit 94 | *.gpState 95 | 96 | # ReSharper is a .NET coding add-in 97 | _ReSharper*/ 98 | *.[Rr]e[Ss]harper 99 | *.DotSettings.user 100 | 101 | # JustCode is a .NET coding add-in 102 | .JustCode 103 | 104 | # TeamCity is a build add-in 105 | _TeamCity* 106 | 107 | # DotCover is a Code Coverage Tool 108 | *.dotCover 109 | 110 | # NCrunch 111 | _NCrunch_* 112 | .*crunch*.local.xml 113 | nCrunchTemp_* 114 | 115 | # MightyMoose 116 | *.mm.* 117 | AutoTest.Net/ 118 | 119 | # Web workbench (sass) 120 | .sass-cache/ 121 | 122 | # Installshield output folder 123 | [Ee]xpress/ 124 | 125 | # DocProject is a documentation generator add-in 126 | DocProject/buildhelp/ 127 | DocProject/Help/*.HxT 128 | DocProject/Help/*.HxC 129 | DocProject/Help/*.hhc 130 | DocProject/Help/*.hhk 131 | DocProject/Help/*.hhp 132 | DocProject/Help/Html2 133 | DocProject/Help/html 134 | 135 | # Click-Once directory 136 | publish/ 137 | 138 | # Publish Web Output 139 | *.[Pp]ublish.xml 140 | *.azurePubxml 141 | # TODO: Comment the next line if you want to checkin your web deploy settings 142 | # but database connection strings (with potential passwords) will be unencrypted 143 | *.pubxml 144 | *.publishproj 145 | 146 | # NuGet Packages 147 | *.nupkg 148 | # The packages folder can be ignored because of Package Restore 149 | **/packages/* 150 | # except build/, which is used as an MSBuild target. 151 | !**/packages/build/ 152 | # Uncomment if necessary however generally it will be regenerated when needed 153 | #!**/packages/repositories.config 154 | 155 | # Microsoft Azure Build Output 156 | csx/ 157 | *.build.csdef 158 | 159 | # Microsoft Azure Emulator 160 | ecf/ 161 | rcf/ 162 | 163 | # Microsoft Azure ApplicationInsights config file 164 | ApplicationInsights.config 165 | 166 | # Windows Store app package directory 167 | AppPackages/ 168 | BundleArtifacts/ 169 | 170 | # Visual Studio cache files 171 | # files ending in .cache can be ignored 172 | *.[Cc]ache 173 | # but keep track of directories ending in .cache 174 | !*.[Cc]ache/ 175 | 176 | # Others 177 | ClientBin/ 178 | ~$* 179 | *~ 180 | *.dbmdl 181 | *.dbproj.schemaview 182 | *.pfx 183 | *.publishsettings 184 | node_modules/ 185 | orleans.codegen.cs 186 | 187 | # RIA/Silverlight projects 188 | Generated_Code/ 189 | 190 | # Backup & report files from converting an old project file 191 | # to a newer Visual Studio version. Backup files are not needed, 192 | # because we have git ;-) 193 | _UpgradeReport_Files/ 194 | Backup*/ 195 | UpgradeLog*.XML 196 | UpgradeLog*.htm 197 | 198 | # SQL Server files 199 | *.mdf 200 | *.ldf 201 | 202 | # Business Intelligence projects 203 | *.rdl.data 204 | *.bim.layout 205 | *.bim_*.settings 206 | 207 | # Microsoft Fakes 208 | FakesAssemblies/ 209 | 210 | # GhostDoc plugin setting file 211 | *.GhostDoc.xml 212 | 213 | # Node.js Tools for Visual Studio 214 | .ntvs_analysis.dat 215 | 216 | # Visual Studio 6 build log 217 | *.plg 218 | 219 | # Visual Studio 6 workspace options file 220 | *.opt 221 | 222 | # Visual Studio LightSwitch build output 223 | **/*.HTMLClient/GeneratedArtifacts 224 | **/*.DesktopClient/GeneratedArtifacts 225 | **/*.DesktopClient/ModelManifest.xml 226 | **/*.Server/GeneratedArtifacts 227 | **/*.Server/ModelManifest.xml 228 | _Pvt_Extensions 229 | 230 | # Paket dependency manager 231 | .paket/paket.exe 232 | 233 | # FAKE - F# Make 234 | .fake/ 235 | -------------------------------------------------------------------------------- /Sources/ProductsApi/Controllers/ProductsController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace ProductsApi.Controllers 8 | { 9 | [Route("api/[controller]")] 10 | public class ProductsController : Controller 11 | { 12 | // GET api/products 13 | [HttpGet] 14 | public string Get() 15 | { 16 | string productsApiVersion = "1.0"; 17 | return $"Executing ProductsApi version {productsApiVersion}. Hostname : {Environment.MachineName}"; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Sources/ProductsApi/Dockerfile.Nano: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:1.0.0-preview2-nanoserver-sdk 2 | 3 | MAINTAINER Julien Corioland, Microsoft (@jcorioland) 4 | 5 | WORKDIR /app 6 | ENTRYPOINT ["dotnet", "run"] 7 | 8 | ENV ASPNETCORE_URLS http://0.0.0.0:5001 9 | EXPOSE 5001 10 | 11 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] 12 | 13 | # Temporary workaround for Windows DNS client weirdness 14 | RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord 15 | 16 | COPY project.json ./ 17 | RUN ["dotnet", "restore"] 18 | 19 | COPY . /app 20 | RUN ["dotnet", "build"] -------------------------------------------------------------------------------- /Sources/ProductsApi/Dockerfile.WSCore: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:1.0.0-preview2-windowsservercore-sdk 2 | 3 | MAINTAINER Julien Corioland, Microsoft (@jcorioland) 4 | 5 | WORKDIR /app 6 | ENTRYPOINT ["dotnet", "run"] 7 | 8 | ENV ASPNETCORE_URLS http://0.0.0.0:5001 9 | EXPOSE 5001 10 | 11 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] 12 | 13 | # Temporary workaround for Windows DNS client weirdness 14 | RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord 15 | 16 | COPY project.json ./ 17 | RUN ["dotnet", "restore"] 18 | 19 | COPY . /app 20 | RUN ["dotnet", "build"] -------------------------------------------------------------------------------- /Sources/ProductsApi/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Hosting; 7 | using Microsoft.AspNetCore.Builder; 8 | using Microsoft.Extensions.Configuration; 9 | 10 | namespace ProductsApi 11 | { 12 | public class Program 13 | { 14 | public static void Main(string[] args) 15 | { 16 | var config = new ConfigurationBuilder() 17 | .AddCommandLine(args) 18 | .AddEnvironmentVariables(prefix: "ASPNETCORE_") 19 | .AddEnvironmentVariables(prefix: "SHOP_") 20 | .Build(); 21 | 22 | var host = new WebHostBuilder() 23 | .UseConfiguration(config) 24 | .UseKestrel() 25 | .UseContentRoot(Directory.GetCurrentDirectory()) 26 | .UseIISIntegration() 27 | .UseStartup() 28 | .Build(); 29 | 30 | host.Run(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Sources/ProductsApi/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:1479/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "launchUrl": "api/values", 15 | "environmentVariables": { 16 | "ASPNETCORE_ENVIRONMENT": "Development" 17 | } 18 | }, 19 | "ProductsApi": { 20 | "commandName": "Project", 21 | "launchBrowser": true, 22 | "launchUrl": "http://localhost:5000/api/values", 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Sources/ProductsApi/README.md: -------------------------------------------------------------------------------- 1 | # Welcome to ASP.NET Core 2 | 3 | We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new. 4 | 5 | You've created a new ASP.NET Core project. [Learn what's new](https://go.microsoft.com/fwlink/?LinkId=518016) 6 | 7 | ## This application consists of: 8 | 9 | * Sample pages using ASP.NET Core MVC 10 | * [Bower](https://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side libraries 11 | * Theming using [Bootstrap](https://go.microsoft.com/fwlink/?LinkID=398939) 12 | 13 | ## How to 14 | 15 | * [Add a Controller and View](https://go.microsoft.com/fwlink/?LinkID=398600) 16 | * [Add an appsetting in config and access it in app.](https://go.microsoft.com/fwlink/?LinkID=699562) 17 | * [Manage User Secrets using Secret Manager.](https://go.microsoft.com/fwlink/?LinkId=699315) 18 | * [Use logging to log a message.](https://go.microsoft.com/fwlink/?LinkId=699316) 19 | * [Add packages using NuGet.](https://go.microsoft.com/fwlink/?LinkId=699317) 20 | * [Add client packages using Bower.](https://go.microsoft.com/fwlink/?LinkId=699318) 21 | * [Target development, staging or production environment.](https://go.microsoft.com/fwlink/?LinkId=699319) 22 | 23 | ## Overview 24 | 25 | * [Conceptual overview of what is ASP.NET Core](https://go.microsoft.com/fwlink/?LinkId=518008) 26 | * [Fundamentals of ASP.NET Core such as Startup and middleware.](https://go.microsoft.com/fwlink/?LinkId=699320) 27 | * [Working with Data](https://go.microsoft.com/fwlink/?LinkId=398602) 28 | * [Security](https://go.microsoft.com/fwlink/?LinkId=398603) 29 | * [Client side development](https://go.microsoft.com/fwlink/?LinkID=699321) 30 | * [Develop on different platforms](https://go.microsoft.com/fwlink/?LinkID=699322) 31 | * [Read more on the documentation site](https://go.microsoft.com/fwlink/?LinkID=699323) 32 | 33 | ## Run & Deploy 34 | 35 | * [Run your app](https://go.microsoft.com/fwlink/?LinkID=517851) 36 | * [Run tools such as EF migrations and more](https://go.microsoft.com/fwlink/?LinkID=517853) 37 | * [Publish to Microsoft Azure Web Apps](https://go.microsoft.com/fwlink/?LinkID=398609) 38 | 39 | We would love to hear your [feedback](https://go.microsoft.com/fwlink/?LinkId=518015) 40 | -------------------------------------------------------------------------------- /Sources/ProductsApi/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Builder; 6 | using Microsoft.AspNetCore.Hosting; 7 | using Microsoft.Extensions.Configuration; 8 | using Microsoft.Extensions.DependencyInjection; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace ProductsApi 12 | { 13 | public class Startup 14 | { 15 | public Startup(IHostingEnvironment env) 16 | { 17 | var builder = new ConfigurationBuilder() 18 | .SetBasePath(env.ContentRootPath) 19 | .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) 20 | .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) 21 | .AddEnvironmentVariables(); 22 | Configuration = builder.Build(); 23 | } 24 | 25 | public IConfigurationRoot Configuration { get; } 26 | 27 | // This method gets called by the runtime. Use this method to add services to the container. 28 | public void ConfigureServices(IServiceCollection services) 29 | { 30 | // Add Cors 31 | services.AddCors(); 32 | // Add framework services. 33 | services.AddMvc(); 34 | } 35 | 36 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 37 | public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 38 | { 39 | loggerFactory.AddConsole(Configuration.GetSection("Logging")); 40 | loggerFactory.AddDebug(); 41 | 42 | app.UseCors(builder => 43 | builder.AllowAnyOrigin() 44 | .AllowAnyMethod() 45 | .AllowAnyHeader() 46 | ); 47 | 48 | app.UseMvc(); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Sources/ProductsApi/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Sources/ProductsApi/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "Microsoft.NETCore.App": { 4 | "version": "1.0.0", 5 | "type": "platform" 6 | }, 7 | "Microsoft.AspNetCore.Mvc": "1.0.0", 8 | "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", 9 | "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", 10 | "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", 11 | "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0", 12 | "Microsoft.Extensions.Configuration.Json": "1.0.0", 13 | "Microsoft.Extensions.Configuration.CommandLine": "1.0.0", 14 | "Microsoft.Extensions.Logging": "1.0.0", 15 | "Microsoft.Extensions.Logging.Console": "1.0.0", 16 | "Microsoft.Extensions.Logging.Debug": "1.0.0", 17 | "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", 18 | "Microsoft.AspNetCore.Cors":"1.0.0" 19 | }, 20 | 21 | "tools": { 22 | "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" 23 | }, 24 | 25 | "frameworks": { 26 | "netcoreapp1.0": { 27 | "imports": [ 28 | "dotnet5.6", 29 | "portable-net45+win8" 30 | ] 31 | } 32 | }, 33 | 34 | "buildOptions": { 35 | "emitEntryPoint": true, 36 | "preserveCompilationContext": true 37 | }, 38 | 39 | "runtimeOptions": { 40 | "configProperties": { 41 | "System.GC.Server": true 42 | } 43 | }, 44 | 45 | "publishOptions": { 46 | "include": [ 47 | "wwwroot", 48 | "Views", 49 | "Areas/**/Views", 50 | "appsettings.json", 51 | "web.config" 52 | ] 53 | }, 54 | 55 | "scripts": { 56 | "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] 57 | }, 58 | 59 | "tooling": { 60 | "defaultNamespace": "ProductsApi" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Sources/ProductsApi/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Sources/RatingsApi/.dockerignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | obj/ -------------------------------------------------------------------------------- /Sources/RatingsApi/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | 84 | # Visual Studio profiler 85 | *.psess 86 | *.vsp 87 | *.vspx 88 | *.sap 89 | 90 | # TFS 2012 Local Workspace 91 | $tf/ 92 | 93 | # Guidance Automation Toolkit 94 | *.gpState 95 | 96 | # ReSharper is a .NET coding add-in 97 | _ReSharper*/ 98 | *.[Rr]e[Ss]harper 99 | *.DotSettings.user 100 | 101 | # JustCode is a .NET coding add-in 102 | .JustCode 103 | 104 | # TeamCity is a build add-in 105 | _TeamCity* 106 | 107 | # DotCover is a Code Coverage Tool 108 | *.dotCover 109 | 110 | # NCrunch 111 | _NCrunch_* 112 | .*crunch*.local.xml 113 | nCrunchTemp_* 114 | 115 | # MightyMoose 116 | *.mm.* 117 | AutoTest.Net/ 118 | 119 | # Web workbench (sass) 120 | .sass-cache/ 121 | 122 | # Installshield output folder 123 | [Ee]xpress/ 124 | 125 | # DocProject is a documentation generator add-in 126 | DocProject/buildhelp/ 127 | DocProject/Help/*.HxT 128 | DocProject/Help/*.HxC 129 | DocProject/Help/*.hhc 130 | DocProject/Help/*.hhk 131 | DocProject/Help/*.hhp 132 | DocProject/Help/Html2 133 | DocProject/Help/html 134 | 135 | # Click-Once directory 136 | publish/ 137 | 138 | # Publish Web Output 139 | *.[Pp]ublish.xml 140 | *.azurePubxml 141 | # TODO: Comment the next line if you want to checkin your web deploy settings 142 | # but database connection strings (with potential passwords) will be unencrypted 143 | *.pubxml 144 | *.publishproj 145 | 146 | # NuGet Packages 147 | *.nupkg 148 | # The packages folder can be ignored because of Package Restore 149 | **/packages/* 150 | # except build/, which is used as an MSBuild target. 151 | !**/packages/build/ 152 | # Uncomment if necessary however generally it will be regenerated when needed 153 | #!**/packages/repositories.config 154 | 155 | # Microsoft Azure Build Output 156 | csx/ 157 | *.build.csdef 158 | 159 | # Microsoft Azure Emulator 160 | ecf/ 161 | rcf/ 162 | 163 | # Microsoft Azure ApplicationInsights config file 164 | ApplicationInsights.config 165 | 166 | # Windows Store app package directory 167 | AppPackages/ 168 | BundleArtifacts/ 169 | 170 | # Visual Studio cache files 171 | # files ending in .cache can be ignored 172 | *.[Cc]ache 173 | # but keep track of directories ending in .cache 174 | !*.[Cc]ache/ 175 | 176 | # Others 177 | ClientBin/ 178 | ~$* 179 | *~ 180 | *.dbmdl 181 | *.dbproj.schemaview 182 | *.pfx 183 | *.publishsettings 184 | node_modules/ 185 | orleans.codegen.cs 186 | 187 | # RIA/Silverlight projects 188 | Generated_Code/ 189 | 190 | # Backup & report files from converting an old project file 191 | # to a newer Visual Studio version. Backup files are not needed, 192 | # because we have git ;-) 193 | _UpgradeReport_Files/ 194 | Backup*/ 195 | UpgradeLog*.XML 196 | UpgradeLog*.htm 197 | 198 | # SQL Server files 199 | *.mdf 200 | *.ldf 201 | 202 | # Business Intelligence projects 203 | *.rdl.data 204 | *.bim.layout 205 | *.bim_*.settings 206 | 207 | # Microsoft Fakes 208 | FakesAssemblies/ 209 | 210 | # GhostDoc plugin setting file 211 | *.GhostDoc.xml 212 | 213 | # Node.js Tools for Visual Studio 214 | .ntvs_analysis.dat 215 | 216 | # Visual Studio 6 build log 217 | *.plg 218 | 219 | # Visual Studio 6 workspace options file 220 | *.opt 221 | 222 | # Visual Studio LightSwitch build output 223 | **/*.HTMLClient/GeneratedArtifacts 224 | **/*.DesktopClient/GeneratedArtifacts 225 | **/*.DesktopClient/ModelManifest.xml 226 | **/*.Server/GeneratedArtifacts 227 | **/*.Server/ModelManifest.xml 228 | _Pvt_Extensions 229 | 230 | # Paket dependency manager 231 | .paket/paket.exe 232 | 233 | # FAKE - F# Make 234 | .fake/ 235 | -------------------------------------------------------------------------------- /Sources/RatingsApi/Controllers/RatingsController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace RatingsApi.Controllers 8 | { 9 | [Route("api/[controller]")] 10 | public class RatingsController : Controller 11 | { 12 | // GET api/ratings 13 | [HttpGet] 14 | public string Get() 15 | { 16 | string ratingsApiVersion = "1.0"; 17 | return $"Executing RatingsApi version {ratingsApiVersion}. Hostname : {Environment.MachineName}"; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Sources/RatingsApi/Dockerfile.Nano: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:1.0.0-preview2-nanoserver-sdk 2 | 3 | MAINTAINER Julien Corioland, Microsoft (@jcorioland) 4 | 5 | WORKDIR /app 6 | ENTRYPOINT ["dotnet", "run"] 7 | 8 | ENV ASPNETCORE_URLS http://0.0.0.0:5002 9 | EXPOSE 5002 10 | 11 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] 12 | 13 | # Temporary workaround for Windows DNS client weirdness 14 | RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord 15 | 16 | COPY project.json ./ 17 | RUN ["dotnet", "restore"] 18 | 19 | COPY . /app 20 | RUN ["dotnet", "build"] -------------------------------------------------------------------------------- /Sources/RatingsApi/Dockerfile.WSCore: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:1.0.0-preview2-windowsservercore-sdk 2 | 3 | MAINTAINER Julien Corioland, Microsoft (@jcorioland) 4 | 5 | WORKDIR /app 6 | ENTRYPOINT ["dotnet", "run"] 7 | 8 | ENV ASPNETCORE_URLS http://0.0.0.0:5002 9 | EXPOSE 5002 10 | 11 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] 12 | 13 | # Temporary workaround for Windows DNS client weirdness 14 | RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord 15 | 16 | COPY project.json ./ 17 | RUN ["dotnet", "restore"] 18 | 19 | COPY . /app 20 | RUN ["dotnet", "build"] -------------------------------------------------------------------------------- /Sources/RatingsApi/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Hosting; 7 | using Microsoft.AspNetCore.Builder; 8 | using Microsoft.Extensions.Configuration; 9 | 10 | namespace RatingsApi 11 | { 12 | public class Program 13 | { 14 | public static void Main(string[] args) 15 | { 16 | var config = new ConfigurationBuilder() 17 | .AddCommandLine(args) 18 | .AddEnvironmentVariables(prefix: "ASPNETCORE_") 19 | .AddEnvironmentVariables(prefix: "SHOP_") 20 | .Build(); 21 | 22 | var host = new WebHostBuilder() 23 | .UseConfiguration(config) 24 | .UseKestrel() 25 | .UseContentRoot(Directory.GetCurrentDirectory()) 26 | .UseIISIntegration() 27 | .UseStartup() 28 | .Build(); 29 | 30 | host.Run(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Sources/RatingsApi/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:1479/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "launchUrl": "api/values", 15 | "environmentVariables": { 16 | "ASPNETCORE_ENVIRONMENT": "Development" 17 | } 18 | }, 19 | "RatingsApi": { 20 | "commandName": "Project", 21 | "launchBrowser": true, 22 | "launchUrl": "http://localhost:5000/api/values", 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Sources/RatingsApi/README.md: -------------------------------------------------------------------------------- 1 | # Welcome to ASP.NET Core 2 | 3 | We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new. 4 | 5 | You've created a new ASP.NET Core project. [Learn what's new](https://go.microsoft.com/fwlink/?LinkId=518016) 6 | 7 | ## This application consists of: 8 | 9 | * Sample pages using ASP.NET Core MVC 10 | * [Bower](https://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side libraries 11 | * Theming using [Bootstrap](https://go.microsoft.com/fwlink/?LinkID=398939) 12 | 13 | ## How to 14 | 15 | * [Add a Controller and View](https://go.microsoft.com/fwlink/?LinkID=398600) 16 | * [Add an appsetting in config and access it in app.](https://go.microsoft.com/fwlink/?LinkID=699562) 17 | * [Manage User Secrets using Secret Manager.](https://go.microsoft.com/fwlink/?LinkId=699315) 18 | * [Use logging to log a message.](https://go.microsoft.com/fwlink/?LinkId=699316) 19 | * [Add packages using NuGet.](https://go.microsoft.com/fwlink/?LinkId=699317) 20 | * [Add client packages using Bower.](https://go.microsoft.com/fwlink/?LinkId=699318) 21 | * [Target development, staging or production environment.](https://go.microsoft.com/fwlink/?LinkId=699319) 22 | 23 | ## Overview 24 | 25 | * [Conceptual overview of what is ASP.NET Core](https://go.microsoft.com/fwlink/?LinkId=518008) 26 | * [Fundamentals of ASP.NET Core such as Startup and middleware.](https://go.microsoft.com/fwlink/?LinkId=699320) 27 | * [Working with Data](https://go.microsoft.com/fwlink/?LinkId=398602) 28 | * [Security](https://go.microsoft.com/fwlink/?LinkId=398603) 29 | * [Client side development](https://go.microsoft.com/fwlink/?LinkID=699321) 30 | * [Develop on different platforms](https://go.microsoft.com/fwlink/?LinkID=699322) 31 | * [Read more on the documentation site](https://go.microsoft.com/fwlink/?LinkID=699323) 32 | 33 | ## Run & Deploy 34 | 35 | * [Run your app](https://go.microsoft.com/fwlink/?LinkID=517851) 36 | * [Run tools such as EF migrations and more](https://go.microsoft.com/fwlink/?LinkID=517853) 37 | * [Publish to Microsoft Azure Web Apps](https://go.microsoft.com/fwlink/?LinkID=398609) 38 | 39 | We would love to hear your [feedback](https://go.microsoft.com/fwlink/?LinkId=518015) 40 | -------------------------------------------------------------------------------- /Sources/RatingsApi/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Builder; 6 | using Microsoft.AspNetCore.Hosting; 7 | using Microsoft.Extensions.Configuration; 8 | using Microsoft.Extensions.DependencyInjection; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace RatingsApi 12 | { 13 | public class Startup 14 | { 15 | public Startup(IHostingEnvironment env) 16 | { 17 | var builder = new ConfigurationBuilder() 18 | .SetBasePath(env.ContentRootPath) 19 | .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) 20 | .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) 21 | .AddEnvironmentVariables(); 22 | Configuration = builder.Build(); 23 | } 24 | 25 | public IConfigurationRoot Configuration { get; } 26 | 27 | // This method gets called by the runtime. Use this method to add services to the container. 28 | public void ConfigureServices(IServiceCollection services) 29 | { 30 | services.AddCors(); 31 | // Add framework services. 32 | services.AddMvc(); 33 | } 34 | 35 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 36 | public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 37 | { 38 | loggerFactory.AddConsole(Configuration.GetSection("Logging")); 39 | loggerFactory.AddDebug(); 40 | 41 | app.UseCors(builder => 42 | builder.AllowAnyOrigin() 43 | .AllowAnyMethod() 44 | .AllowAnyHeader() 45 | ); 46 | 47 | app.UseMvc(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Sources/RatingsApi/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Sources/RatingsApi/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "Microsoft.NETCore.App": { 4 | "version": "1.0.0", 5 | "type": "platform" 6 | }, 7 | "Microsoft.AspNetCore.Mvc": "1.0.0", 8 | "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", 9 | "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", 10 | "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", 11 | "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0", 12 | "Microsoft.Extensions.Configuration.Json": "1.0.0", 13 | "Microsoft.Extensions.Configuration.CommandLine": "1.0.0", 14 | "Microsoft.Extensions.Logging": "1.0.0", 15 | "Microsoft.Extensions.Logging.Console": "1.0.0", 16 | "Microsoft.Extensions.Logging.Debug": "1.0.0", 17 | "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", 18 | "Microsoft.AspNetCore.Cors":"1.0.0" 19 | }, 20 | 21 | "tools": { 22 | "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" 23 | }, 24 | 25 | "frameworks": { 26 | "netcoreapp1.0": { 27 | "imports": [ 28 | "dotnet5.6", 29 | "portable-net45+win8" 30 | ] 31 | } 32 | }, 33 | 34 | "buildOptions": { 35 | "emitEntryPoint": true, 36 | "preserveCompilationContext": true 37 | }, 38 | 39 | "runtimeOptions": { 40 | "configProperties": { 41 | "System.GC.Server": true 42 | } 43 | }, 44 | 45 | "publishOptions": { 46 | "include": [ 47 | "wwwroot", 48 | "Views", 49 | "Areas/**/Views", 50 | "appsettings.json", 51 | "web.config" 52 | ] 53 | }, 54 | 55 | "scripts": { 56 | "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] 57 | }, 58 | 59 | "tooling": { 60 | "defaultNamespace": "RatingsApi" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Sources/RatingsApi/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Sources/ShopFront/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "wwwroot/lib" 3 | } 4 | -------------------------------------------------------------------------------- /Sources/ShopFront/.dockerignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | obj/ 3 | lib/ -------------------------------------------------------------------------------- /Sources/ShopFront/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | 84 | # Visual Studio profiler 85 | *.psess 86 | *.vsp 87 | *.vspx 88 | *.sap 89 | 90 | # TFS 2012 Local Workspace 91 | $tf/ 92 | 93 | # Guidance Automation Toolkit 94 | *.gpState 95 | 96 | # ReSharper is a .NET coding add-in 97 | _ReSharper*/ 98 | *.[Rr]e[Ss]harper 99 | *.DotSettings.user 100 | 101 | # JustCode is a .NET coding add-in 102 | .JustCode 103 | 104 | # TeamCity is a build add-in 105 | _TeamCity* 106 | 107 | # DotCover is a Code Coverage Tool 108 | *.dotCover 109 | 110 | # NCrunch 111 | _NCrunch_* 112 | .*crunch*.local.xml 113 | nCrunchTemp_* 114 | 115 | # MightyMoose 116 | *.mm.* 117 | AutoTest.Net/ 118 | 119 | # Web workbench (sass) 120 | .sass-cache/ 121 | 122 | # Installshield output folder 123 | [Ee]xpress/ 124 | 125 | # DocProject is a documentation generator add-in 126 | DocProject/buildhelp/ 127 | DocProject/Help/*.HxT 128 | DocProject/Help/*.HxC 129 | DocProject/Help/*.hhc 130 | DocProject/Help/*.hhk 131 | DocProject/Help/*.hhp 132 | DocProject/Help/Html2 133 | DocProject/Help/html 134 | 135 | # Click-Once directory 136 | publish/ 137 | 138 | # Publish Web Output 139 | *.[Pp]ublish.xml 140 | *.azurePubxml 141 | # TODO: Comment the next line if you want to checkin your web deploy settings 142 | # but database connection strings (with potential passwords) will be unencrypted 143 | *.pubxml 144 | *.publishproj 145 | 146 | # NuGet Packages 147 | *.nupkg 148 | # The packages folder can be ignored because of Package Restore 149 | **/packages/* 150 | # except build/, which is used as an MSBuild target. 151 | !**/packages/build/ 152 | # Uncomment if necessary however generally it will be regenerated when needed 153 | #!**/packages/repositories.config 154 | 155 | # Microsoft Azure Build Output 156 | csx/ 157 | *.build.csdef 158 | 159 | # Microsoft Azure Emulator 160 | ecf/ 161 | rcf/ 162 | 163 | # Microsoft Azure ApplicationInsights config file 164 | ApplicationInsights.config 165 | 166 | # Windows Store app package directory 167 | AppPackages/ 168 | BundleArtifacts/ 169 | 170 | # Visual Studio cache files 171 | # files ending in .cache can be ignored 172 | *.[Cc]ache 173 | # but keep track of directories ending in .cache 174 | !*.[Cc]ache/ 175 | 176 | # Others 177 | ClientBin/ 178 | ~$* 179 | *~ 180 | *.dbmdl 181 | *.dbproj.schemaview 182 | *.pfx 183 | *.publishsettings 184 | node_modules/ 185 | orleans.codegen.cs 186 | 187 | # RIA/Silverlight projects 188 | Generated_Code/ 189 | 190 | # Backup & report files from converting an old project file 191 | # to a newer Visual Studio version. Backup files are not needed, 192 | # because we have git ;-) 193 | _UpgradeReport_Files/ 194 | Backup*/ 195 | UpgradeLog*.XML 196 | UpgradeLog*.htm 197 | 198 | # SQL Server files 199 | *.mdf 200 | *.ldf 201 | 202 | # Business Intelligence projects 203 | *.rdl.data 204 | *.bim.layout 205 | *.bim_*.settings 206 | 207 | # Microsoft Fakes 208 | FakesAssemblies/ 209 | 210 | # GhostDoc plugin setting file 211 | *.GhostDoc.xml 212 | 213 | # Node.js Tools for Visual Studio 214 | .ntvs_analysis.dat 215 | 216 | # Visual Studio 6 build log 217 | *.plg 218 | 219 | # Visual Studio 6 workspace options file 220 | *.opt 221 | 222 | # Visual Studio LightSwitch build output 223 | **/*.HTMLClient/GeneratedArtifacts 224 | **/*.DesktopClient/GeneratedArtifacts 225 | **/*.DesktopClient/ModelManifest.xml 226 | **/*.Server/GeneratedArtifacts 227 | **/*.Server/ModelManifest.xml 228 | _Pvt_Extensions 229 | 230 | # Paket dependency manager 231 | .paket/paket.exe 232 | 233 | # FAKE - F# Make 234 | .fake/ 235 | -------------------------------------------------------------------------------- /Sources/ShopFront/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Mvc; 6 | using Microsoft.Extensions.Options; 7 | 8 | namespace ShopFront.Controllers 9 | { 10 | public class HomeController : Controller 11 | { 12 | private readonly IOptions _settings; 13 | 14 | public HomeController(IOptions settings) 15 | { 16 | _settings = settings; 17 | } 18 | 19 | public IActionResult Index() 20 | { 21 | return View(_settings); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sources/ShopFront/Dockerfile.Nano: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:1.0.0-preview2-nanoserver-sdk 2 | 3 | MAINTAINER Julien Corioland, Microsoft (@jcorioland) 4 | 5 | WORKDIR /app 6 | ENTRYPOINT ["dotnet", "run"] 7 | 8 | ENV ASPNETCORE_URLS http://0.0.0.0:5000 9 | EXPOSE 5000 10 | 11 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] 12 | 13 | # Temporary workaround for Windows DNS client weirdness 14 | RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord 15 | 16 | COPY project.json ./ 17 | RUN ["dotnet", "restore"] 18 | 19 | COPY . /app 20 | RUN ["dotnet", "build"] -------------------------------------------------------------------------------- /Sources/ShopFront/Dockerfile.WSCore: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:1.0.0-preview2-windowsservercore-sdk 2 | 3 | MAINTAINER Julien Corioland, Microsoft (@jcorioland) 4 | 5 | WORKDIR /app 6 | ENTRYPOINT ["dotnet", "run"] 7 | 8 | ENV ASPNETCORE_URLS http://0.0.0.0:5000 9 | EXPOSE 5000 10 | 11 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] 12 | 13 | # Temporary workaround for Windows DNS client weirdness 14 | RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord 15 | 16 | COPY project.json ./ 17 | RUN ["dotnet", "restore"] 18 | 19 | COPY . /app 20 | RUN ["dotnet", "build"] -------------------------------------------------------------------------------- /Sources/ShopFront/Models/Settings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShopFront.Models 4 | { 5 | public class Settings 6 | { 7 | public string ProductsApiUrl { get; set; } 8 | public string RatingsApiUrl { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /Sources/ShopFront/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Hosting; 7 | using Microsoft.Extensions.Configuration; 8 | 9 | namespace ShopFront 10 | { 11 | public class Program 12 | { 13 | public static void Main(string[] args) 14 | { 15 | var config = new ConfigurationBuilder() 16 | .AddCommandLine(args) 17 | .AddEnvironmentVariables(prefix: "ASPNETCORE_") 18 | .AddEnvironmentVariables(prefix: "SHOP_") 19 | .Build(); 20 | 21 | var host = new WebHostBuilder() 22 | .UseConfiguration(config) 23 | .UseKestrel() 24 | .UseContentRoot(Directory.GetCurrentDirectory()) 25 | .UseIISIntegration() 26 | .UseStartup() 27 | .Build(); 28 | 29 | host.Run(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Sources/ShopFront/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:55462/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "ShopFront": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "launchUrl": "http://localhost:5000", 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development" 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sources/ShopFront/README.md: -------------------------------------------------------------------------------- 1 | # Welcome to ASP.NET Core 2 | 3 | We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new. 4 | 5 | You've created a new ASP.NET Core project. [Learn what's new](https://go.microsoft.com/fwlink/?LinkId=518016) 6 | 7 | ## This application consists of: 8 | 9 | * Sample pages using ASP.NET Core MVC 10 | * [Bower](https://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side libraries 11 | * Theming using [Bootstrap](https://go.microsoft.com/fwlink/?LinkID=398939) 12 | 13 | ## How to 14 | 15 | * [Add a Controller and View](https://go.microsoft.com/fwlink/?LinkID=398600) 16 | * [Add an appsetting in config and access it in app.](https://go.microsoft.com/fwlink/?LinkID=699562) 17 | * [Manage User Secrets using Secret Manager.](https://go.microsoft.com/fwlink/?LinkId=699315) 18 | * [Use logging to log a message.](https://go.microsoft.com/fwlink/?LinkId=699316) 19 | * [Add packages using NuGet.](https://go.microsoft.com/fwlink/?LinkId=699317) 20 | * [Add client packages using Bower.](https://go.microsoft.com/fwlink/?LinkId=699318) 21 | * [Target development, staging or production environment.](https://go.microsoft.com/fwlink/?LinkId=699319) 22 | 23 | ## Overview 24 | 25 | * [Conceptual overview of what is ASP.NET Core](https://go.microsoft.com/fwlink/?LinkId=518008) 26 | * [Fundamentals of ASP.NET Core such as Startup and middleware.](https://go.microsoft.com/fwlink/?LinkId=699320) 27 | * [Working with Data](https://go.microsoft.com/fwlink/?LinkId=398602) 28 | * [Security](https://go.microsoft.com/fwlink/?LinkId=398603) 29 | * [Client side development](https://go.microsoft.com/fwlink/?LinkID=699321) 30 | * [Develop on different platforms](https://go.microsoft.com/fwlink/?LinkID=699322) 31 | * [Read more on the documentation site](https://go.microsoft.com/fwlink/?LinkID=699323) 32 | 33 | ## Run & Deploy 34 | 35 | * [Run your app](https://go.microsoft.com/fwlink/?LinkID=517851) 36 | * [Run tools such as EF migrations and more](https://go.microsoft.com/fwlink/?LinkID=517853) 37 | * [Publish to Microsoft Azure Web Apps](https://go.microsoft.com/fwlink/?LinkID=398609) 38 | 39 | We would love to hear your [feedback](https://go.microsoft.com/fwlink/?LinkId=518015) 40 | -------------------------------------------------------------------------------- /Sources/ShopFront/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Builder; 6 | using Microsoft.AspNetCore.Hosting; 7 | using Microsoft.Extensions.Configuration; 8 | using Microsoft.Extensions.DependencyInjection; 9 | using Microsoft.Extensions.Logging; 10 | using Microsoft.Extensions.Options; 11 | 12 | namespace ShopFront 13 | { 14 | public class Startup 15 | { 16 | public Startup(IHostingEnvironment env) 17 | { 18 | var builder = new ConfigurationBuilder() 19 | .SetBasePath(env.ContentRootPath) 20 | .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) 21 | .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) 22 | .AddEnvironmentVariables(); 23 | Configuration = builder.Build(); 24 | } 25 | 26 | public IConfigurationRoot Configuration { get; } 27 | 28 | // This method gets called by the runtime. Use this method to add services to the container. 29 | public void ConfigureServices(IServiceCollection services) 30 | { 31 | // Add framework services. 32 | services.AddMvc(); 33 | 34 | // settings 35 | services.Configure(settings => 36 | { 37 | settings.ProductsApiUrl = Configuration["SHOP_PRODUCTS_API_URL"]; 38 | settings.RatingsApiUrl = Configuration["SHOP_RATINGS_API_URL"]; 39 | }); 40 | } 41 | 42 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 43 | public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 44 | { 45 | loggerFactory.AddConsole(Configuration.GetSection("Logging")); 46 | loggerFactory.AddDebug(); 47 | 48 | if (env.IsDevelopment()) 49 | { 50 | app.UseDeveloperExceptionPage(); 51 | app.UseBrowserLink(); 52 | } 53 | else 54 | { 55 | app.UseExceptionHandler("/Home/Error"); 56 | } 57 | 58 | app.UseStaticFiles(); 59 | 60 | app.UseMvc(routes => 61 | { 62 | routes.MapRoute( 63 | name: "default", 64 | template: "{controller=Home}/{action=Index}/{id?}"); 65 | }); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Sources/ShopFront/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @inject Microsoft.Extensions.Options.IOptions settings 2 | @{ 3 | ViewData["Title"] = "Welcome home"; 4 | } 5 | 6 |
7 |
8 |

@ViewData["Title"]

9 |
10 |
11 |
12 | 13 |
14 |
15 |

Products Api

16 | 17 |
18 |
19 |

Ratings Api

20 | 21 |
22 |
23 | 24 | @section scripts { 25 | 66 | } -------------------------------------------------------------------------------- /Sources/ShopFront/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Error"; 3 | } 4 | 5 |

Error.

6 |

An error occurred while processing your request.

7 | 8 |

Development Mode

9 |

10 | Swapping to Development environment will display more detailed information about the error that occurred. 11 |

12 |

13 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. 14 |

15 | -------------------------------------------------------------------------------- /Sources/ShopFront/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | @ViewData["Title"] - MyShop 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 38 |
39 | @RenderBody() 40 |
41 |
42 |

© 2016 - MyShop

43 |
44 |
45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 60 | 61 | 62 | 63 | @RenderSection("scripts", required: false) 64 | 65 | 66 | -------------------------------------------------------------------------------- /Sources/ShopFront/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using ShopFront 2 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 3 | -------------------------------------------------------------------------------- /Sources/ShopFront/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /Sources/ShopFront/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Sources/ShopFront/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shopfront", 3 | "private": true, 4 | "dependencies": { 5 | "bootstrap": "3.3.6", 6 | "jquery": "2.2.3", 7 | "jquery-validation": "1.15.0", 8 | "jquery-validation-unobtrusive": "3.2.6" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Sources/ShopFront/bundleconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "outputFileName": "wwwroot/css/site.min.css", 4 | "inputFiles": [ 5 | "wwwroot/css/site.css" 6 | ] 7 | }, 8 | { 9 | "outputFileName": "wwwroot/js/site.min.js", 10 | "inputFiles": [ 11 | "wwwroot/js/site.js" 12 | ], 13 | "minify": { 14 | "enabled": true, 15 | "renameLocals": true 16 | }, 17 | "sourceMap": false 18 | } 19 | ] 20 | -------------------------------------------------------------------------------- /Sources/ShopFront/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "Microsoft.NETCore.App": { 4 | "version": "1.0.0", 5 | "type": "platform" 6 | }, 7 | "Microsoft.AspNetCore.Diagnostics": "1.0.0", 8 | "Microsoft.AspNetCore.Mvc": "1.0.0", 9 | "Microsoft.AspNetCore.Razor.Tools": { 10 | "version": "1.0.0-preview2-final", 11 | "type": "build" 12 | }, 13 | "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", 14 | "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", 15 | "Microsoft.AspNetCore.StaticFiles": "1.0.0", 16 | "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", 17 | "Microsoft.Extensions.Configuration.Json": "1.0.0", 18 | "Microsoft.Extensions.Configuration.CommandLine": "1.0.0", 19 | "Microsoft.Extensions.Logging": "1.0.0", 20 | "Microsoft.Extensions.Logging.Console": "1.0.0", 21 | "Microsoft.Extensions.Logging.Debug": "1.0.0", 22 | "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", 23 | "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0" 24 | }, 25 | 26 | "tools": { 27 | "BundlerMinifier.Core": "2.0.238", 28 | "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final", 29 | "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" 30 | }, 31 | 32 | "frameworks": { 33 | "netcoreapp1.0": { 34 | "imports": [ 35 | "dotnet5.6", 36 | "portable-net45+win8" 37 | ] 38 | } 39 | }, 40 | 41 | "buildOptions": { 42 | "emitEntryPoint": true, 43 | "preserveCompilationContext": true 44 | }, 45 | 46 | "runtimeOptions": { 47 | "configProperties": { 48 | "System.GC.Server": true 49 | } 50 | }, 51 | 52 | "publishOptions": { 53 | "include": [ 54 | "wwwroot", 55 | "Views", 56 | "Areas/**/Views", 57 | "appsettings.json", 58 | "web.config" 59 | ] 60 | }, 61 | 62 | "scripts": { 63 | "precompile": [ "dotnet bundle" ], 64 | "prepublish": [ "bower install" ], 65 | "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] 66 | }, 67 | 68 | "tooling": { 69 | "defaultNamespace": "ShopFront" 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Sources/ShopFront/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Sources/ShopFront/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Wrapping element */ 7 | /* Set some basic padding to keep content from hitting the edges */ 8 | .body-content { 9 | padding-left: 15px; 10 | padding-right: 15px; 11 | } 12 | 13 | /* Set widths on the form inputs since otherwise they're 100% wide */ 14 | input, 15 | select, 16 | textarea { 17 | max-width: 280px; 18 | } 19 | 20 | /* Carousel */ 21 | .carousel-caption p { 22 | font-size: 20px; 23 | line-height: 1.4; 24 | } 25 | 26 | /* Make .svg files in the carousel display properly in older browsers */ 27 | .carousel-inner .item img[src$=".svg"] 28 | { 29 | width: 100%; 30 | } 31 | 32 | /* Hide/rearrange for smaller screens */ 33 | @media screen and (max-width: 767px) { 34 | /* Hide captions */ 35 | .carousel-caption { 36 | display: none 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Sources/ShopFront/wwwroot/css/site.min.css: -------------------------------------------------------------------------------- 1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}input,select,textarea{max-width:280px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}@media screen and (max-width:767px){.carousel-caption{display:none}} -------------------------------------------------------------------------------- /Sources/ShopFront/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcorioland/WindowsContainersHOL/386d62f58dd1fdf2e94a0269d23541e1881e98c3/Sources/ShopFront/wwwroot/favicon.ico -------------------------------------------------------------------------------- /Sources/ShopFront/wwwroot/images/banner1.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Sources/ShopFront/wwwroot/images/banner2.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Sources/ShopFront/wwwroot/images/banner3.svg: -------------------------------------------------------------------------------- 1 | banner3b -------------------------------------------------------------------------------- /Sources/ShopFront/wwwroot/images/banner4.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Sources/ShopFront/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Write your Javascript code. 2 | -------------------------------------------------------------------------------- /Sources/docker-compose-nanoserver.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | networks: 3 | nat: 4 | external: true 5 | 6 | services: 7 | products-service: 8 | image: jcorioland/products-api:1.0.0-preview2-nanoserver 9 | ports: 10 | - "5001:5001" 11 | networks: 12 | nat: 13 | ipv4_address: 172.26.127.31 14 | ratings-service: 15 | image: jcorioland/ratings-api:1.0.0-preview2-nanoserver 16 | ports: 17 | - "5002:5002" 18 | networks: 19 | nat: 20 | ipv4_address: 172.26.127.32 21 | shop-front: 22 | image: jcorioland/shop-front:1.0.0-preview2-nanoserver 23 | ports: 24 | - "5000:5000" 25 | networks: 26 | nat: 27 | ipv4_address: 172.26.127.30 28 | environment: 29 | - SHOP_PRODUCTS_API_URL=http://172.26.127.31:5001 30 | - SHOP_RATINGS_API_URL=http://172.26.127.32:5002 -------------------------------------------------------------------------------- /Sources/docker-compose-windowsservercore.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | networks: 3 | nat: 4 | external: true 5 | 6 | services: 7 | products-service: 8 | image: jcorioland/products-api:1.0.0-preview2-windowsservercore 9 | ports: 10 | - "5001:5001" 11 | networks: 12 | nat: 13 | ipv4_address: 172.26.127.31 14 | ratings-service: 15 | image: jcorioland/ratings-api:1.0.0-preview2-windowsservercore 16 | ports: 17 | - "5002:5002" 18 | networks: 19 | nat: 20 | ipv4_address: 172.26.127.32 21 | shop-front: 22 | image: jcorioland/shop-front:1.0.0-preview2-windowsservercore 23 | ports: 24 | - "5000:5000" 25 | networks: 26 | nat: 27 | ipv4_address: 172.26.127.30 28 | environment: 29 | - SHOP_PRODUCTS_API_URL=http://172.26.127.31:5001 30 | - SHOP_RATINGS_API_URL=http://172.26.127.32:5002 --------------------------------------------------------------------------------