diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..10813e37c3 --- /dev/null +++ b/.dockerignore @@ -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 diff --git a/Dockerfile.windows b/Dockerfile.windows new file mode 100644 index 0000000000..f388d11596 --- /dev/null +++ b/Dockerfile.windows @@ -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 diff --git a/README.md b/README.md index 5ed228891f..6aff27a49b 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/docker-compose.windows.yml b/docker-compose.windows.yml new file mode 100644 index 0000000000..7d7e74c8fb --- /dev/null +++ b/docker-compose.windows.yml @@ -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