Skip to content

Commit 845133d

Browse files
committed
230413
1 parent 5d5be62 commit 845133d

File tree

9 files changed

+133
-10
lines changed

9 files changed

+133
-10
lines changed

.dockerignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**/.classpath
2+
**/.dockerignore
3+
**/.env
4+
**/.git
5+
**/.gitignore
6+
**/.project
7+
**/.settings
8+
**/.toolstarget
9+
**/.vs
10+
**/.vscode
11+
**/*.*proj.user
12+
**/*.dbmdl
13+
**/*.jfm
14+
**/azds.yaml
15+
**/bin
16+
**/charts
17+
**/docker-compose*
18+
**/Dockerfile*
19+
**/node_modules
20+
**/npm-debug.log
21+
**/obj
22+
**/secrets.dev.yaml
23+
**/values.dev.yaml
24+
LICENSE
25+
README.md

YANLib.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lib", "lib", "{25EA463A-93D
4141
EndProject
4242
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YANLib", "lib\YANLib\YANLib.csproj", "{8B38E857-59CA-446E-8E46-EAD98567E96E}"
4343
EndProject
44+
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{696811A9-FD68-4538-85AD-07BB9C30CFCA}"
45+
EndProject
4446
Global
4547
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4648
Debug|Any CPU = Debug|Any CPU
@@ -107,6 +109,10 @@ Global
107109
{8B38E857-59CA-446E-8E46-EAD98567E96E}.Debug|Any CPU.Build.0 = Debug|Any CPU
108110
{8B38E857-59CA-446E-8E46-EAD98567E96E}.Release|Any CPU.ActiveCfg = Release|Any CPU
109111
{8B38E857-59CA-446E-8E46-EAD98567E96E}.Release|Any CPU.Build.0 = Release|Any CPU
112+
{696811A9-FD68-4538-85AD-07BB9C30CFCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
113+
{696811A9-FD68-4538-85AD-07BB9C30CFCA}.Debug|Any CPU.Build.0 = Debug|Any CPU
114+
{696811A9-FD68-4538-85AD-07BB9C30CFCA}.Release|Any CPU.ActiveCfg = Release|Any CPU
115+
{696811A9-FD68-4538-85AD-07BB9C30CFCA}.Release|Any CPU.Build.0 = Release|Any CPU
110116
EndGlobalSection
111117
GlobalSection(SolutionProperties) = preSolution
112118
HideSolutionNode = FALSE

docker-compose.dcproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
3+
<PropertyGroup Label="Globals">
4+
<ProjectVersion>2.1</ProjectVersion>
5+
<DockerTargetOS>Linux</DockerTargetOS>
6+
<ProjectGuid>696811a9-fd68-4538-85ad-07bb9c30cfca</ProjectGuid>
7+
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
8+
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}</DockerServiceUrl>
9+
<DockerServiceName>yanlib.httpapi.host</DockerServiceName>
10+
</PropertyGroup>
11+
<ItemGroup>
12+
<None Include="docker-compose.override.yml">
13+
<DependentUpon>docker-compose.yml</DependentUpon>
14+
</None>
15+
<None Include="docker-compose.yml" />
16+
<None Include=".dockerignore" />
17+
</ItemGroup>
18+
</Project>

docker-compose.override.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '3.4'
2+
3+
services:
4+
yanlib.httpapi.host:
5+
environment:
6+
- ASPNETCORE_ENVIRONMENT=Development
7+
- ASPNETCORE_URLS=https://+:443;http://+:80
8+
ports:
9+
- "80"
10+
- "443"
11+
volumes:
12+
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
13+
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro

docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: '3.4'
2+
3+
services:
4+
yanlib.httpapi.host:
5+
image: ${DOCKER_REGISTRY-}yanlibhttpapihost
6+
build:
7+
context: .
8+
dockerfile: host/YANLib.HttpApi.Host/Dockerfile
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
2+
3+
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
4+
WORKDIR /app
5+
EXPOSE 80
6+
EXPOSE 443
7+
8+
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
9+
WORKDIR /src
10+
COPY ["NuGet.Config", "."]
11+
COPY ["lib/YANLib/nuget.config", "lib/YANLib/"]
12+
COPY ["host/YANLib.HttpApi.Host/YANLib.HttpApi.Host.csproj", "host/YANLib.HttpApi.Host/"]
13+
COPY ["src/YANLib.Application/YANLib.Application.csproj", "src/YANLib.Application/"]
14+
COPY ["lib/YANLib/YANLib.csproj", "lib/YANLib/"]
15+
COPY ["src/YANLib.Domain/YANLib.Domain.csproj", "src/YANLib.Domain/"]
16+
COPY ["src/YANLib.Domain.Shared/YANLib.Domain.Shared.csproj", "src/YANLib.Domain.Shared/"]
17+
COPY ["src/YANLib.Application.Contracts/YANLib.Application.Contracts.csproj", "src/YANLib.Application.Contracts/"]
18+
COPY ["src/YANLib.EntityFrameworkCore/YANLib.EntityFrameworkCore.csproj", "src/YANLib.EntityFrameworkCore/"]
19+
COPY ["src/YANLib.HttpApi/YANLib.HttpApi.csproj", "src/YANLib.HttpApi/"]
20+
RUN dotnet restore "host/YANLib.HttpApi.Host/YANLib.HttpApi.Host.csproj"
21+
COPY . .
22+
WORKDIR "/src/host/YANLib.HttpApi.Host"
23+
RUN dotnet build "YANLib.HttpApi.Host.csproj" -c Release -o /app/build
24+
25+
FROM build AS publish
26+
RUN dotnet publish "YANLib.HttpApi.Host.csproj" -c Release -o /app/publish /p:UseAppHost=false
27+
28+
FROM base AS final
29+
WORKDIR /app
30+
COPY --from=publish /app/publish .
31+
ENTRYPOINT ["dotnet", "YANLib.HttpApi.Host.dll"]
Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
{
2-
"iisSettings": {
3-
"windowsAuthentication": false,
4-
"anonymousAuthentication": true,
5-
"iisExpress": {
6-
"applicationUrl": "https://localhost:44380",
7-
"sslPort": 44380
8-
}
9-
},
102
"profiles": {
113
"IIS Express": {
124
"commandName": "IISExpress",
@@ -18,10 +10,25 @@
1810
"YANLib.HttpApi.Host": {
1911
"commandName": "Project",
2012
"launchBrowser": true,
21-
"applicationUrl": "https://localhost:44380",
2213
"environmentVariables": {
2314
"ASPNETCORE_ENVIRONMENT": "Development"
24-
}
15+
},
16+
"applicationUrl": "https://localhost:44380"
17+
},
18+
"Docker": {
19+
"commandName": "Docker",
20+
"launchBrowser": true,
21+
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
22+
"publishAllPorts": true,
23+
"useSSL": true
24+
}
25+
},
26+
"iisSettings": {
27+
"windowsAuthentication": false,
28+
"anonymousAuthentication": true,
29+
"iisExpress": {
30+
"applicationUrl": "https://localhost:44380",
31+
"sslPort": 44380
2532
}
2633
}
2734
}

host/YANLib.HttpApi.Host/YANLib.HttpApi.Host.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@
77
<RootNamespace>YANLib</RootNamespace>
88
<PreserveCompilationReferences>true</PreserveCompilationReferences>
99
<UserSecretsId>YANLib-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
10+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
11+
<DockerfileContext>..\..</DockerfileContext>
12+
<DockerComposeProjectPath>..\..\docker-compose.dcproj</DockerComposeProjectPath>
1013
</PropertyGroup>
1114

1215
<ItemGroup>
16+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.2" />
1317
<PackageReference Include="Serilog.AspNetCore" Version="5.0.0" />
1418
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
1519
<PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="6.0.0" />

launchSettings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"profiles": {
3+
"Docker Compose": {
4+
"commandName": "DockerCompose",
5+
"commandVersion": "1.0",
6+
"serviceActions": {
7+
"yanlib.httpapi.host": "StartDebugging"
8+
}
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)