Create Ocelot project

This commit is contained in:
Eduard Tomàs 2018-01-11 11:20:38 +01:00
parent 33d066389d
commit e72ada31fb
8 changed files with 190 additions and 1 deletions

View File

@ -219,4 +219,11 @@ services:
rabbitmq:
ports:
- "15672:15672"
- "5672:5672"
- "5672:5672"
ocelotapigw:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "80"

View File

@ -107,3 +107,10 @@ services:
rabbitmq:
image: rabbitmq:3-management-alpine
ocelotapigw:
image: ocelotapigw
build:
context: .
dockerfile: src/Apigw/OcelotApiGw/Dockerfile

View File

@ -97,6 +97,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebHost", "WebHost", "{1815
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebHost.Customization", "src\BuildingBlocks\WebHostCustomization\WebHost.Customization\WebHost.Customization.csproj", "{15F4B3AA-89B6-4A0D-9051-414305974781}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ApiGw", "ApiGw", "{7A58AA20-67F3-48F3-88C8-24EBFE621792}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OcelotApiGw", "src\Apigw\OcelotApiGw\OcelotApiGw.csproj", "{E0C5162E-DF26-4341-9E51-14AE800D7505}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
@ -1311,6 +1315,54 @@ Global
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|x64.Build.0 = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|x86.ActiveCfg = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|x86.Build.0 = Release|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.AppStore|ARM.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.AppStore|iPhone.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.AppStore|x64.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.AppStore|x64.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.AppStore|x86.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.AppStore|x86.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Debug|ARM.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Debug|ARM.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Debug|iPhone.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Debug|x64.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Debug|x64.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Debug|x86.ActiveCfg = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Debug|x86.Build.0 = Debug|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|Any CPU.Build.0 = Release|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|ARM.ActiveCfg = Release|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|ARM.Build.0 = Release|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|iPhone.ActiveCfg = Release|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|iPhone.Build.0 = Release|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|x64.ActiveCfg = Release|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|x64.Build.0 = Release|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|x86.ActiveCfg = Release|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -1357,6 +1409,8 @@ Global
{969E793C-C413-490E-9C9D-B2B46DA5AF32} = {EF0337F2-ED00-4643-89FD-EE10863F1870}
{1815B651-941C-466B-AE33-D1D7EEB8F77F} = {DB0EFB20-B024-4E5E-A75C-52143C131D25}
{15F4B3AA-89B6-4A0D-9051-414305974781} = {1815B651-941C-466B-AE33-D1D7EEB8F77F}
{7A58AA20-67F3-48F3-88C8-24EBFE621792} = {932D8224-11F6-4D07-B109-DA28AD288A63}
{E0C5162E-DF26-4341-9E51-14AE800D7505} = {7A58AA20-67F3-48F3-88C8-24EBFE621792}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {25728519-5F0F-4973-8A64-0A81EB4EA8D9}

View File

@ -0,0 +1,20 @@
FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY *.sln ./
COPY src/Apigw/OcelotApiGw/OcelotApiGw.csproj src/Apigw/OcelotApiGw/
RUN dotnet restore
COPY . .
WORKDIR /src/src/Apigw/OcelotApiGw
RUN dotnet build -c Release -o /app
FROM build AS publish
RUN dotnet publish -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "OcelotApiGw.dll"]

View File

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3" />
</ItemGroup>
</Project>

View File

@ -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 OcelotApiGw
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
}

View File

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:64020/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"OcelotApiGw": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:64021/"
}
}
}

View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace OcelotApiGw
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
}
// 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.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
}
}
}