Skip to content
This repository was archived by the owner on Oct 11, 2023. It is now read-only.

Commit 93606bc

Browse files
authored
Merge pull request #134 from Greenie0506/existingWindowsContainer
Existing windows container
2 parents f9d611a + 8844311 commit 93606bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+981
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ bld/
2626

2727
# Visual Studio 2015 cache/options directory
2828
.vs/
29+
.vscode/
2930
# Uncomment if you have tasks that create the project's static files in wwwroot
3031
#wwwroot/
3132

@@ -71,6 +72,7 @@ artifacts/
7172
*.pidb
7273
*.svclog
7374
*.scc
75+
*.sln
7476

7577
# Chutzpah Test files
7678
_Chutzpah*
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
**/.dockerignore
2+
**/.env
3+
**/.git
4+
**/.gitignore
5+
**/.vs
6+
**/.vscode
7+
**/*.*proj.user
8+
**/azds.yaml
9+
**/charts
10+
**/bin
11+
**/obj
12+
**/Dockerfile
13+
**/Dockerfile.develop
14+
**/docker-compose.yml
15+
**/docker-compose.*.yml
16+
**/*.dbmdl
17+
**/*.jfm
18+
**/secrets.dev.yaml
19+
**/values.dev.yaml
20+
**/.toolstarget
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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 mywebapi.Controllers
8+
{
9+
[Route("api/[controller]")]
10+
public class ValuesController : Controller
11+
{
12+
// GET api/values
13+
[HttpGet]
14+
public IEnumerable<string> Get()
15+
{
16+
return new string[] { System.Runtime.InteropServices.RuntimeInformation.OSDescription };
17+
}
18+
19+
// GET api/values/5
20+
[HttpGet("{id}")]
21+
public string Get(int id)
22+
{
23+
return System.Runtime.InteropServices.RuntimeInformation.OSDescription;
24+
}
25+
26+
// POST api/values
27+
[HttpPost]
28+
public void Post([FromBody]string value)
29+
{
30+
}
31+
32+
// PUT api/values/5
33+
[HttpPut("{id}")]
34+
public void Put(int id, [FromBody]string value)
35+
{
36+
}
37+
38+
// DELETE api/values/5
39+
[HttpDelete("{id}")]
40+
public void Delete(int id)
41+
{
42+
}
43+
}
44+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
2+
#For more information, please see https://aka.ms/containercompat
3+
4+
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1-nanoserver-1809 AS base
5+
WORKDIR /app
6+
EXPOSE 80
7+
8+
FROM mcr.microsoft.com/dotnet/core/sdk:2.1-nanoserver-1809 AS build
9+
WORKDIR /src
10+
COPY ["mywebapi.csproj", ""]
11+
RUN dotnet restore "mywebapi.csproj"
12+
COPY . .
13+
WORKDIR "/src/"
14+
RUN dotnet build "mywebapi.csproj" -c Release -o /app
15+
16+
FROM build AS publish
17+
RUN dotnet publish "mywebapi.csproj" -c Release -o /app
18+
19+
FROM base AS final
20+
WORKDIR /app
21+
COPY --from=publish /app .
22+
ENTRYPOINT ["dotnet", "mywebapi.dll"]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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;
7+
using Microsoft.AspNetCore.Hosting;
8+
using Microsoft.Extensions.Configuration;
9+
using Microsoft.Extensions.Logging;
10+
11+
namespace mywebapi
12+
{
13+
public class Program
14+
{
15+
public static void Main(string[] args)
16+
{
17+
BuildWebHost(args).Run();
18+
}
19+
20+
public static IWebHost BuildWebHost(string[] args) =>
21+
WebHost.CreateDefaultBuilder(args)
22+
.UseStartup<Startup>()
23+
.Build();
24+
}
25+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:62732/",
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+
"mywebapi": {
20+
"commandName": "Project",
21+
"launchBrowser": true,
22+
"launchUrl": "api/values",
23+
"environmentVariables": {
24+
"ASPNETCORE_ENVIRONMENT": "Development"
25+
},
26+
"applicationUrl": "http://localhost:62733/"
27+
},
28+
"Docker": {
29+
"commandName": "Docker",
30+
"launchBrowser": true,
31+
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/api/values",
32+
"environmentVariables": {},
33+
"httpPort": 62733
34+
}
35+
}
36+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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 mywebapi
13+
{
14+
public class Startup
15+
{
16+
public Startup(IConfiguration configuration)
17+
{
18+
Configuration = configuration;
19+
}
20+
21+
public IConfiguration Configuration { get; }
22+
23+
// This method gets called by the runtime. Use this method to add services to the container.
24+
public void ConfigureServices(IServiceCollection services)
25+
{
26+
services.AddMvc();
27+
}
28+
29+
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
30+
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
31+
{
32+
if (env.IsDevelopment())
33+
{
34+
app.UseDeveloperExceptionPage();
35+
}
36+
37+
app.UseMvc();
38+
}
39+
}
40+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"Logging": {
3+
"IncludeScopes": false,
4+
"LogLevel": {
5+
"Default": "Debug",
6+
"System": "Information",
7+
"Microsoft": "Information"
8+
}
9+
}
10+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"Logging": {
3+
"IncludeScopes": false,
4+
"Debug": {
5+
"LogLevel": {
6+
"Default": "Warning"
7+
}
8+
},
9+
"Console": {
10+
"LogLevel": {
11+
"Default": "Warning"
12+
}
13+
}
14+
}
15+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj
22+
.vscode/

0 commit comments

Comments
 (0)