feat 新增docker支持
This commit is contained in:
30
.dockerignore
Normal file
30
.dockerignore
Normal file
@ -0,0 +1,30 @@
|
||||
**/.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
|
||||
!**/.gitignore
|
||||
!.git/HEAD
|
||||
!.git/config
|
||||
!.git/packed-refs
|
||||
!.git/refs/heads/**
|
||||
24
applications/KonSoft.AuthServer/Dockerfile
Normal file
24
applications/KonSoft.AuthServer/Dockerfile
Normal file
@ -0,0 +1,24 @@
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||
USER $APP_UID
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
EXPOSE 8081
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["NuGet.Config", "."]
|
||||
COPY ["applications/KonSoft.AuthServer/KonSoft.AuthServer.csproj", "applications/KonSoft.AuthServer/"]
|
||||
RUN dotnet restore "./applications/KonSoft.AuthServer/KonSoft.AuthServer.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/applications/KonSoft.AuthServer"
|
||||
RUN dotnet build "./KonSoft.AuthServer.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./KonSoft.AuthServer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "KonSoft.AuthServer.dll"]
|
||||
@ -11,6 +11,8 @@
|
||||
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
|
||||
<PreserveCompilationReferences>true</PreserveCompilationReferences>
|
||||
<UserSecretsId>KonSoft-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerfileContext>..\..</DockerfileContext>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -37,6 +39,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.4" />
|
||||
|
||||
@ -1,12 +1,4 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "https://localhost:44322",
|
||||
"sslPort": 44322
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
@ -18,10 +10,29 @@
|
||||
"KonSoft.AuthServer": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:44322",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:44322"
|
||||
},
|
||||
"Container (Dockerfile)": {
|
||||
"commandName": "Docker",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_HTTPS_PORTS": "8081",
|
||||
"ASPNETCORE_HTTP_PORTS": "8080"
|
||||
},
|
||||
"publishAllPorts": true,
|
||||
"useSSL": true
|
||||
}
|
||||
},
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "https://localhost:44322",
|
||||
"sslPort": 44322
|
||||
}
|
||||
}
|
||||
}
|
||||
30
microservices/KonSoft.Admin.HttpApi.Host/Dockerfile
Normal file
30
microservices/KonSoft.Admin.HttpApi.Host/Dockerfile
Normal file
@ -0,0 +1,30 @@
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||
USER $APP_UID
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
EXPOSE 8081
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["NuGet.Config", "."]
|
||||
COPY ["microservices/KonSoft.Admin.HttpApi.Host/KonSoft.Admin.HttpApi.Host.csproj", "microservices/KonSoft.Admin.HttpApi.Host/"]
|
||||
COPY ["modules/admin/src/KonSoft.Admin.Application/KonSoft.Admin.Application.csproj", "modules/admin/src/KonSoft.Admin.Application/"]
|
||||
COPY ["modules/admin/src/KonSoft.Admin.Domain/KonSoft.Admin.Domain.csproj", "modules/admin/src/KonSoft.Admin.Domain/"]
|
||||
COPY ["modules/admin/src/KonSoft.Admin.Domain.Shared/KonSoft.Admin.Domain.Shared.csproj", "modules/admin/src/KonSoft.Admin.Domain.Shared/"]
|
||||
COPY ["modules/admin/src/KonSoft.Admin.Application.Contracts/KonSoft.Admin.Application.Contracts.csproj", "modules/admin/src/KonSoft.Admin.Application.Contracts/"]
|
||||
COPY ["modules/admin/src/KonSoft.Admin.EntityFrameworkCore/KonSoft.Admin.EntityFrameworkCore.csproj", "modules/admin/src/KonSoft.Admin.EntityFrameworkCore/"]
|
||||
COPY ["modules/admin/src/KonSoft.Admin.HttpApi/KonSoft.Admin.HttpApi.csproj", "modules/admin/src/KonSoft.Admin.HttpApi/"]
|
||||
RUN dotnet restore "./microservices/KonSoft.Admin.HttpApi.Host/KonSoft.Admin.HttpApi.Host.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/microservices/KonSoft.Admin.HttpApi.Host"
|
||||
RUN dotnet build "./KonSoft.Admin.HttpApi.Host.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./KonSoft.Admin.HttpApi.Host.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "KonSoft.Admin.HttpApi.Host.dll"]
|
||||
@ -6,9 +6,12 @@
|
||||
<RootNamespace>KonSoft.Admin</RootNamespace>
|
||||
<PreserveCompilationReferences>true</PreserveCompilationReferences>
|
||||
<UserSecretsId>KonSoft.Admin-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerfileContext>..\..</DockerfileContext>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.4" />
|
||||
|
||||
@ -1,12 +1,4 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "https://localhost:44354",
|
||||
"sslPort": 44354
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
@ -18,10 +10,29 @@
|
||||
"KonSoft.Admin.HttpApi.Host": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:44354",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:44354"
|
||||
},
|
||||
"Container (Dockerfile)": {
|
||||
"commandName": "Docker",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_HTTPS_PORTS": "8081",
|
||||
"ASPNETCORE_HTTP_PORTS": "8080"
|
||||
},
|
||||
"publishAllPorts": true,
|
||||
"useSSL": true
|
||||
}
|
||||
},
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "https://localhost:44354",
|
||||
"sslPort": 44354
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user