Skip to content

Commit

Permalink
feat(issue-221): add dockerfiles for services
Browse files Browse the repository at this point in the history
Merge pull request #222 from live-dev999/live-dev999/issue221
  • Loading branch information
live-dev999 committed Mar 14, 2022
2 parents 726e044 + b1c3eb6 commit e98f385
Show file tree
Hide file tree
Showing 20 changed files with 558 additions and 76 deletions.
25 changes: 25 additions & 0 deletions src/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
267 changes: 265 additions & 2 deletions src/O2NextGen-Prototypes.sln

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions src/Services/auth/O2NextGen.Auth.Web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:2.2 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:2.2 AS build
WORKDIR /src
COPY ["Services/auth/O2NextGen.Auth.Web/O2NextGen.Auth.Web.csproj", "Services/auth/O2NextGen.Auth.Web/"]
RUN dotnet restore "Services/auth/O2NextGen.Auth.Web/O2NextGen.Auth.Web.csproj"
COPY . .
WORKDIR "/src/Services/auth/O2NextGen.Auth.Web"
RUN dotnet build "O2NextGen.Auth.Web.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "O2NextGen.Auth.Web.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "O2NextGen.Auth.Web.dll"]
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ public void Format(LogEvent logEvent, TextWriter output)

private void FormatBody(LogEvent logEvent, TextWriter output)
{
using (var writer = new JsonTextWriter(output))
{


var writer = new JsonTextWriter(output);

// add json body
writer.WriteStartObject();

Expand Down Expand Up @@ -83,7 +81,7 @@ private void FormatBody(LogEvent logEvent, TextWriter output)

writer.WriteEndObject();
writer.Flush();
} }
}

private static string FormatLogLevel(LogEventLevel level)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
<UserSecretsId>adca6dac-ab6b-4a1a-b8c4-03f600c16f45</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..\..</DockerfileContext>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1">
</PackageReference>
<PackageReference Include="Serilog.Settings.Configuration" Version="2.2.0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
"O2NextGen.Auth": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:10001;http://localhost:10000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"applicationUrl": "https://localhost:10001;http://localhost:5001"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true,
"useSSL": true
}
}
}
19 changes: 10 additions & 9 deletions src/Services/c-gen/O2NextGen.CertificateManagement.Api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
FROM mcr.microsoft.com/dotnet/aspnet:2.2 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
FROM mcr.microsoft.com/dotnet/sdk:2.2 AS build
WORKDIR /src
COPY ["O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj", "O2NextGen.CertificateManagement.Api/"]
COPY ["O2NextGen.CertificateManagement.Business/O2NextGen.CertificateManagement.Business.csproj", "O2NextGen.CertificateManagement.Business/"]
COPY ["O2NextGen.CertificateManagement.Data/O2NextGen.CertificateManagement.Data.csproj", "O2NextGen.CertificateManagement.Data/"]
COPY ["O2NextGen.CertificateManagement.Impl/O2NextGen.CertificateManagement.Impl.csproj", "O2NextGen.CertificateManagement.Impl/"]
RUN dotnet restore "O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj"
COPY ["Services/c-gen/O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj", "Services/c-gen/O2NextGen.CertificateManagement.Api/"]
COPY ["Services/c-gen/O2NextGen.CertificateManagement.Data/O2NextGen.CertificateManagement.Data.csproj", "Services/c-gen/O2NextGen.CertificateManagement.Data/"]
COPY ["Services/c-gen/O2NextGen.CertificateManagement.Impl/O2NextGen.CertificateManagement.Impl.csproj", "Services/c-gen/O2NextGen.CertificateManagement.Impl/"]
COPY ["Services/c-gen/O2NextGen.CertificateManagement.Business/O2NextGen.CertificateManagement.Business.csproj", "Services/c-gen/O2NextGen.CertificateManagement.Business/"]
RUN dotnet restore "Services/c-gen/O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj"
COPY . .
WORKDIR "/src/O2NextGen.CertificateManagement.Api"
WORKDIR "/src/Services/c-gen/O2NextGen.CertificateManagement.Api"
RUN dotnet build "O2NextGen.CertificateManagement.Api.csproj" -c Release -o /app/build

FROM build AS publish
Expand All @@ -21,4 +22,4 @@ RUN dotnet publish "O2NextGen.CertificateManagement.Api.csproj" -c Release -o /a
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "O2NextGen.CertificateManagement.Api.dll"]
ENTRYPOINT ["dotnet", "O2NextGen.CertificateManagement.Api.dll"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /src
COPY ["O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj", "O2NextGen.CertificateManagement.Api/"]
COPY ["O2NextGen.CertificateManagement.Business/O2NextGen.CertificateManagement.Business.csproj", "O2NextGen.CertificateManagement.Business/"]
COPY ["O2NextGen.CertificateManagement.Data/O2NextGen.CertificateManagement.Data.csproj", "O2NextGen.CertificateManagement.Data/"]
COPY ["O2NextGen.CertificateManagement.Impl/O2NextGen.CertificateManagement.Impl.csproj", "O2NextGen.CertificateManagement.Impl/"]
RUN dotnet restore "O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj"
COPY . .
WORKDIR "/src/O2NextGen.CertificateManagement.Api"
RUN dotnet build "O2NextGen.CertificateManagement.Api.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "O2NextGen.CertificateManagement.Api.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "O2NextGen.CertificateManagement.Api.dll"]
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<UserSecretsId>e238f36a-3514-4436-b624-9b4f799bb82d</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..\..</DockerfileContext>
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>

<ItemGroup>
Expand All @@ -12,6 +16,7 @@
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.2.0">
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1">
</PackageReference>
<PackageReference Include="Serilog.Settings.Configuration" Version="2.2.0">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
{
{
"profiles": {
"O2NextGen.CertificateManagement.Web": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"applicationUrl": "https://localhost:10002;http://localhost:5002"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true,
"useSSL": true
}
}
}
}
25 changes: 25 additions & 0 deletions src/Services/e-sender/O2NextGen.ESender.Api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:2.2 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:2.2 AS build
WORKDIR /src
COPY ["Services/e-sender/O2NextGen.ESender.Api/O2NextGen.ESender.Api.csproj", "Services/e-sender/O2NextGen.ESender.Api/"]
COPY ["Services/e-sender/O2NextGen.ESender.Impl/O2NextGen.ESender.Impl.csproj", "Services/e-sender/O2NextGen.ESender.Impl/"]
COPY ["Services/e-sender/O2NextGen.ESender.Data/O2NextGen.ESender.Data.csproj", "Services/e-sender/O2NextGen.ESender.Data/"]
COPY ["Services/e-sender/O2NextGen.ESender.Business/O2NextGen.ESender.Business.csproj", "Services/e-sender/O2NextGen.ESender.Business/"]
RUN dotnet restore "Services/e-sender/O2NextGen.ESender.Api/O2NextGen.ESender.Api.csproj"
COPY . .
WORKDIR "/src/Services/e-sender/O2NextGen.ESender.Api"
RUN dotnet build "O2NextGen.ESender.Api.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "O2NextGen.ESender.Api.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "O2NextGen.ESender.Api.dll"]
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<UserSecretsId>e7c66e1c-578d-4339-9f29-38bda0a56f64</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..\..</DockerfileContext>
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>

<ItemGroup>
Expand All @@ -15,6 +19,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1">
</PackageReference>
<PackageReference Include="Serilog.Settings.Configuration" Version="2.2.0">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:26083",
"sslPort": 44314
Expand All @@ -21,11 +21,17 @@
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"applicationUrl": "https://localhost:10004;http://localhost:5004"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/api/values",
"publishAllPorts": true,
"useSSL": true
}
}
}

}
25 changes: 25 additions & 0 deletions src/Services/smalltalk/O2NextGen.SmallTalk.Api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:2.2 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:2.2 AS build
WORKDIR /src
COPY ["Services/smalltalk/O2NextGen.SmallTalk.Api/O2NextGen.SmallTalk.Api.csproj", "Services/smalltalk/O2NextGen.SmallTalk.Api/"]
COPY ["Services/smalltalk/O2NextGen.SmallTalk.Data/O2NextGen.SmallTalk.Data.csproj", "Services/smalltalk/O2NextGen.SmallTalk.Data/"]
COPY ["Services/smalltalk/O2NextGen.SmallTalk.Business/O2NextGen.SmallTalk.Business.csproj", "Services/smalltalk/O2NextGen.SmallTalk.Business/"]
COPY ["Services/smalltalk/O2NextGen.SmallTalk.Impl/O2NextGen.SmallTalk.Impl.csproj", "Services/smalltalk/O2NextGen.SmallTalk.Impl/"]
RUN dotnet restore "Services/smalltalk/O2NextGen.SmallTalk.Api/O2NextGen.SmallTalk.Api.csproj"
COPY . .
WORKDIR "/src/Services/smalltalk/O2NextGen.SmallTalk.Api"
RUN dotnet build "O2NextGen.SmallTalk.Api.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "O2NextGen.SmallTalk.Api.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "O2NextGen.SmallTalk.Api.dll"]
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<UserSecretsId>3e239bd5-b8d6-455f-8e46-ea4782668914</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..\..</DockerfileContext>
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>

<ItemGroup>
Expand All @@ -10,6 +14,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:21322",
"sslPort": 44362
Expand All @@ -21,11 +21,17 @@
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"applicationUrl": "https://localhost:10003;http://localhost:5003"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/api/values",
"publishAllPorts": true,
"useSSL": true
}
}
}

}
Loading

0 comments on commit e98f385

Please sign in to comment.