Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivien FABING committed Nov 13, 2017
1 parent 4f94a85 commit 4325a92
Show file tree
Hide file tree
Showing 14 changed files with 266 additions and 0 deletions.
31 changes: 31 additions & 0 deletions OMC.Docker.sln
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2005
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OMC.DockerApi", "OMC.DockerApi\OMC.DockerApi.csproj", "{54C24714-3E44-4EF1-A9B3-C37863091B5A}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{CD9984A8-3373-4BEF-A101-7BF6084A5AFD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{54C24714-3E44-4EF1-A9B3-C37863091B5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{54C24714-3E44-4EF1-A9B3-C37863091B5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54C24714-3E44-4EF1-A9B3-C37863091B5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54C24714-3E44-4EF1-A9B3-C37863091B5A}.Release|Any CPU.Build.0 = Release|Any CPU
{CD9984A8-3373-4BEF-A101-7BF6084A5AFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD9984A8-3373-4BEF-A101-7BF6084A5AFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD9984A8-3373-4BEF-A101-7BF6084A5AFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD9984A8-3373-4BEF-A101-7BF6084A5AFD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8D51562E-35CD-46E6-B452-C28D3442B50B}
EndGlobalSection
EndGlobal
3 changes: 3 additions & 0 deletions OMC.DockerApi/.dockerignore
@@ -0,0 +1,3 @@
*
!obj/Docker/publish/*
!obj/Docker/empty/
44 changes: 44 additions & 0 deletions OMC.DockerApi/Controllers/ValuesController.cs
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace OMC.DockerApi.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
// GET api/values
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}

// GET api/values/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}

// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}

// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}

// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}
6 changes: 6 additions & 0 deletions OMC.DockerApi/Dockerfile
@@ -0,0 +1,6 @@
FROM microsoft/aspnetcore:2.0
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "OMC.DockerApi.dll"]
20 changes: 20 additions & 0 deletions OMC.DockerApi/OMC.DockerApi.csproj
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>

<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions OMC.DockerApi/Program.cs
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace OMC.DockerApi
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}

public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
}
29 changes: 29 additions & 0 deletions OMC.DockerApi/Properties/launchSettings.json
@@ -0,0 +1,29 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:24476/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"OMC.DockerApi": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:24477/"
}
}
}
40 changes: 40 additions & 0 deletions OMC.DockerApi/Startup.cs
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

namespace OMC.DockerApi
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}

public IConfiguration Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.UseMvc();
}
}
}
10 changes: 10 additions & 0 deletions OMC.DockerApi/appsettings.Development.json
@@ -0,0 +1,10 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
15 changes: 15 additions & 0 deletions OMC.DockerApi/appsettings.json
@@ -0,0 +1,15 @@
{
"Logging": {
"IncludeScopes": false,
"Debug": {
"LogLevel": {
"Default": "Warning"
}
},
"Console": {
"LogLevel": {
"Default": "Warning"
}
}
}
}
9 changes: 9 additions & 0 deletions docker-compose.ci.build.yml
@@ -0,0 +1,9 @@
version: '3'

services:
ci-build:
image: microsoft/aspnetcore-build:1.0-2.0
volumes:
- .:/src
working_dir: /src
command: /bin/bash -c "dotnet restore ./OMC.Docker.sln && dotnet publish ./OMC.Docker.sln -c Release -o ./obj/Docker/publish"
18 changes: 18 additions & 0 deletions docker-compose.dcproj
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
<PropertyGroup Label="Globals">
<ProjectVersion>2.0</ProjectVersion>
<DockerTargetOS>Linux</DockerTargetOS>
<ProjectGuid>cd9984a8-3373-4bef-a101-7bf6084a5afd</ProjectGuid>
<DockerLaunchBrowser>True</DockerLaunchBrowser>
<DockerServiceUrl>http://localhost:{ServicePort}/api/values</DockerServiceUrl>
<DockerServiceName>omc.dockerapi</DockerServiceName>
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose.ci.build.yml" />
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions docker-compose.override.yml
@@ -0,0 +1,8 @@
version: '3'

services:
omc.dockerapi:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "80"
8 changes: 8 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,8 @@
version: '3'

services:
omc.dockerapi:
image: omc.dockerapi
build:
context: ./OMC.DockerApi
dockerfile: Dockerfile

0 comments on commit 4325a92

Please sign in to comment.