Skip to content

Commit

Permalink
feat: コンテナー オーケストレーター サポートの追加
Browse files Browse the repository at this point in the history
  • Loading branch information
Shigezo32 committed Nov 24, 2018
1 parent 257f93b commit b5a0f56
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.dockerignore
.env
.git
.gitignore
.vs
.vscode
docker-compose.yml
docker-compose.*.yml
*/bin
*/obj
22 changes: 22 additions & 0 deletions MagicOnionInDocker.HttpGateway/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY MagicOnionInDocker.HttpGateway/MagicOnionInDocker.HttpGateway.csproj MagicOnionInDocker.HttpGateway/
COPY MagicOnionInDocker.Server/MagicOnionInDocker.Server.csproj MagicOnionInDocker.Server/
COPY MagicOnionInDocker.ServiceDefinition/MagicOnionInDocker.ServiceDefinition.csproj MagicOnionInDocker.ServiceDefinition/
RUN dotnet restore MagicOnionInDocker.HttpGateway/MagicOnionInDocker.HttpGateway.csproj
COPY . .
WORKDIR /src/MagicOnionInDocker.HttpGateway
RUN dotnet build MagicOnionInDocker.HttpGateway.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish MagicOnionInDocker.HttpGateway.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "MagicOnionInDocker.HttpGateway.dll"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
<UserSecretsId>895ef8cb-2665-4872-8665-354f3161a89d</UserSecretsId>
</PropertyGroup>

<ItemGroup>
Expand Down
19 changes: 19 additions & 0 deletions MagicOnionInDocker.Server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM microsoft/dotnet:2.1-runtime AS base
WORKDIR /app

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY MagicOnionInDocker.Server/MagicOnionInDocker.Server.csproj MagicOnionInDocker.Server/
COPY MagicOnionInDocker.ServiceDefinition/MagicOnionInDocker.ServiceDefinition.csproj MagicOnionInDocker.ServiceDefinition/
RUN dotnet restore MagicOnionInDocker.Server/MagicOnionInDocker.Server.csproj
COPY . .
WORKDIR /src/MagicOnionInDocker.Server
RUN dotnet build MagicOnionInDocker.Server.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish MagicOnionInDocker.Server.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "MagicOnionInDocker.Server.dll"]
6 changes: 6 additions & 0 deletions MagicOnionInDocker.ServiceDefinition.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagicOnionInDocker.Server",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagicOnionInDocker.HttpGateway", "MagicOnionInDocker.HttpGateway\MagicOnionInDocker.HttpGateway.csproj", "{A28FF46C-A611-436A-898A-D7AA7DC55FE5}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{0FA831D4-CE58-4C7F-9801-1BDC7E8C1076}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -27,6 +29,10 @@ Global
{A28FF46C-A611-436A-898A-D7AA7DC55FE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A28FF46C-A611-436A-898A-D7AA7DC55FE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A28FF46C-A611-436A-898A-D7AA7DC55FE5}.Release|Any CPU.Build.0 = Release|Any CPU
{0FA831D4-CE58-4C7F-9801-1BDC7E8C1076}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0FA831D4-CE58-4C7F-9801-1BDC7E8C1076}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0FA831D4-CE58-4C7F-9801-1BDC7E8C1076}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0FA831D4-CE58-4C7F-9801-1BDC7E8C1076}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
18 changes: 18 additions & 0 deletions docker-compose.dcproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
<PropertyGroup Label="Globals">
<ProjectVersion>2.1</ProjectVersion>
<DockerTargetOS>Linux</DockerTargetOS>
<ProjectGuid>0fa831d4-ce58-4c7f-9801-1bdc7e8c1076</ProjectGuid>
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}</DockerServiceUrl>
<DockerServiceName>magiconionindocker.httpgateway</DockerServiceName>
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
<None Include=".dockerignore" />
</ItemGroup>
</Project>
14 changes: 14 additions & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.4'

services:
magiconionindocker.httpgateway:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
- ASPNETCORE_HTTPS_PORT=44378
ports:
- "43640:80"
- "44378:443"
volumes:
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3.4'

services:
magiconionindocker.server:
image: ${DOCKER_REGISTRY-}magiconionindockerserver
build:
context: .
dockerfile: MagicOnionInDocker.Server/Dockerfile

magiconionindocker.httpgateway:
image: ${DOCKER_REGISTRY-}magiconionindockerhttpgateway
build:
context: .
dockerfile: MagicOnionInDocker.HttpGateway/Dockerfile

0 comments on commit b5a0f56

Please sign in to comment.