Skip to content

Commit ed9c5e2

Browse files
committed
add docker support
1 parent be7a155 commit ed9c5e2

File tree

6 files changed

+100
-1
lines changed

6 files changed

+100
-1
lines changed

.vscode/launch.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
// Use IntelliSense to find out which attributes exist for C# debugging
3+
// Use hover for the description of the existing attributes
4+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": ".NET Core Launch (web)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
// If you have changed target frameworks, make sure to update the program path.
13+
"program": "${workspaceRoot}/src/CookieSample/bin/Debug/netcoreapp2.0/CookieSample.dll",
14+
"args": [],
15+
"cwd": "${workspaceRoot}/src/CookieSample",
16+
"stopAtEntry": false,
17+
"internalConsoleOptions": "openOnSessionStart",
18+
"launchBrowser": {
19+
"enabled": true,
20+
"args": "${auto-detect-url}",
21+
"windows": {
22+
"command": "cmd.exe",
23+
"args": "/C start ${auto-detect-url}"
24+
},
25+
"osx": {
26+
"command": "open"
27+
},
28+
"linux": {
29+
"command": "xdg-open"
30+
}
31+
},
32+
"env": {
33+
"ASPNETCORE_ENVIRONMENT": "Development"
34+
},
35+
"sourceFileMap": {
36+
"/Views": "${workspaceRoot}/Views"
37+
}
38+
},
39+
{
40+
"name": ".NET Core Attach",
41+
"type": "coreclr",
42+
"request": "attach",
43+
"processId": "${command:pickProcess}"
44+
}
45+
]
46+
}

.vscode/tasks.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "0.1.0",
3+
"command": "dotnet",
4+
"isShellCommand": true,
5+
"args": [],
6+
"tasks": [
7+
{
8+
"taskName": "build",
9+
"args": [
10+
"${workspaceRoot}/src/CookieSample/CookieSample.csproj"
11+
],
12+
"isBuildCommand": true,
13+
"problemMatcher": "$msCompile"
14+
}
15+
]
16+
}

NuGet.config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<add key="AspNetCore" value="https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json" />
6+
<add key="AspNetCoreTools" value="https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json" />
7+
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
8+
</packageSources>
9+
</configuration>

NuGetPackageVerifier.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"Default": {
3+
"rules": [
4+
"DefaultCompositeRule"
5+
]
6+
}
7+
}

src/IdentityServerSample/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM microsoft/dotnet:latest
2+
COPY . /app
3+
WORKDIR /app
4+
5+
RUN dotnet restore
6+
RUN dotnet build
7+
8+
EXPOSE 4000/tcp
9+
ENV ASPNETCORE_URLS http://*:4000
10+
ENV ASPNETCORE_ENVIRONMENT Production
11+
12+
ENTRYPOINT dotnet run

src/IdentityServerSample/Program.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;
5+
using System.Net;
56
using System.Threading.Tasks;
67
using Microsoft.AspNetCore;
78
using Microsoft.AspNetCore.Hosting;
@@ -18,7 +19,15 @@ public static void Main(string[] args)
1819
}
1920

2021
public static IWebHost BuildWebHost(string[] args) =>
21-
WebHost.CreateDefaultBuilder(args)
22+
new WebHostBuilder()
23+
.UseKestrel(options=>{
24+
options.Listen(IPAddress.Parse("0.0.0.0"), 4000);
25+
})
26+
.UseContentRoot(Directory.GetCurrentDirectory())
27+
.ConfigureLogging((hostingContext, logging) =>
28+
{
29+
logging.AddConsole();
30+
})
2231
.UseStartup<Startup>()
2332
.Build();
2433
}

0 commit comments

Comments
 (0)