Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM microsoft/dotnet:1.0.0-preview2.1-nanoserver-sdk

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]

# REMARK: Temporary workaround for Windows DNS client weirdness
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord

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
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

* [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 \src\MusicStore\`.
Expand Down
24 changes: 24 additions & 0 deletions docker-compose.windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '2.1'
services:
db:
image: microsoft/mssql-server-2016-express-windows
environment:
sa_password: "Password1"
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"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does db,1433 work? I have been doing db:1433

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comma is the canonical representation, and just want to echo this commenter's sentiment: http://stackoverflow.com/questions/5294721/how-to-specify-a-port-number-in-sql-server-connection-string#comment27379349_5294741

depends_on:
- "db"
ports:
- "5000:5000"

networks:
default:
external:
name: nat