Add details on running in Docker Windows containers

This commit is contained in:
Michael Friis 2016-10-09 14:12:30 -07:00 коммит произвёл Kiran Challa
Родитель bf7eaa166c
Коммит 8ce50e3fb3
4 изменённых файлов: 96 добавлений и 0 удалений

47
.dockerignore Normal file
Просмотреть файл

@ -0,0 +1,47 @@
.git
**/project.lock.json
**/Obj/
**/obj/
**/bin/
**/Bin/
.vs/
*.xap
*.user
/TestResults
*.vspscc
*.vssscc
*.suo
*.cache
*.docstates
_ReSharper.*
*.csproj.user
*[Rr]e[Ss]harper.user
_ReSharper.*/
packages/*
artifacts/*
msbuild.log
PublishProfiles/
*.psess
*.vsp
*.pidb
*.userprefs
*DS_Store
*.ncrunchsolution
*.log
*.vspx
/.symbols
nuget.exe
build/
*net45.csproj
*k10.csproj
App_Data/
bower_components
node_modules
*.sln.ide
*.ng.ts
*.sln.ide
project.lock.json
.build/
.testpublish/
launchSettings.json

17
Dockerfile.windows Normal file
Просмотреть файл

@ -0,0 +1,17 @@
FROM microsoft/dotnet-nightly:1.1-sdk-projectjson-nanoserver
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN New-Item -Path \MusicStore\samples\MusicStore.Standalone -Type Directory
WORKDIR MusicStore
ADD samples/MusicStore.Standalone/project.json samples/MusicStore.Standalone/project.json
ADD NuGet.config .
RUN dotnet restore .\samples\MusicStore.Standalone
ADD samples samples
RUN dotnet build .\samples\MusicStore.Standalone
EXPOSE 5000
ENV ASPNETCORE_URLS http://0.0.0.0:5000
CMD dotnet run -p .\samples\MusicStore.Standalone

Просмотреть файл

@ -25,6 +25,13 @@ This project is part of ASP.NET Core. You can find samples, documentation and ge
* **[CustomHost]:**
6. Run `dnx . run` (This hosts the app in a console application - Application started at URL **http://localhost:5003/**).
## Run on Docker Windows Containers
* [Install Docker for Windows](https://docs.docker.com/docker-for-windows/) or [setup up Docker Windows containers](https://msdn.microsoft.com/en-us/virtualization/windowscontainers/containers_welcome)
* `docker-compose -f .\docker-compose.windows.yml build`
* `docker-compose -f .\docker-compose.windows.yml up`
* Access MusicStore on either the Windows VM IP or (if container is running locally) on the container IP: `docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" musicstore_web_1`
## To run the sample on Mac/Mono:
* Follow the instructions at the [Home](https://github.com/aspnet/Home) repository to install Mono and DNVM on Mac OS X.
* Open a command prompt and execute `cd samples/MusicStore.Standalone`.

Просмотреть файл

@ -0,0 +1,25 @@
version: '3'
services:
db:
image: microsoft/mssql-server-windows-express
environment:
sa_password: "Password1"
ACCEPT_EULA: "Y"
ports:
- "1433:1433" # REMARK: This is currently required, needs investigation
web:
build:
context: .
dockerfile: Dockerfile.windows
environment:
- "Data:DefaultConnection:ConnectionString=Server=db,1433;Database=MusicStore;User Id=sa;Password=Password1;MultipleActiveResultSets=True"
depends_on:
- "db"
ports:
- "5000:5000"
networks:
default:
external:
name: nat