wip: web端
parent
ba1a0e86fd
commit
3c9373654a
@ -1,20 +1,47 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
#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.
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||||
|
USER app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 80
|
EXPOSE 8080
|
||||||
EXPOSE 443
|
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["NPin/NPin.csproj", "NPin/"]
|
COPY ["src/NPin.Web/NPin.Web.csproj", "src/NPin.Web/"]
|
||||||
RUN dotnet restore "NPin/NPin.csproj"
|
COPY ["framework/NPin.Framework.AspNetCore.Authentication.OAuth/NPin.Framework.AspNetCore.Authentication.OAuth.csproj", "framework/NPin.Framework.AspNetCore.Authentication.OAuth/"]
|
||||||
|
COPY ["framework/NPin.Framework.AspNetCore/NPin.Framework.AspNetCore.csproj", "framework/NPin.Framework.AspNetCore/"]
|
||||||
|
COPY ["framework/NPin.Framework.Core/NPin.Framework.Core.csproj", "framework/NPin.Framework.Core/"]
|
||||||
|
COPY ["src/NPin.Application/NPin.Application.csproj", "src/NPin.Application/"]
|
||||||
|
COPY ["framework/NPin.Framework.Ddd.Application/NPin.Framework.Ddd.Application.csproj", "framework/NPin.Framework.Ddd.Application/"]
|
||||||
|
COPY ["framework/NPin.Framework.Ddd.Application.Contracts/NPin.Framework.Ddd.Application.Contracts.csproj", "framework/NPin.Framework.Ddd.Application.Contracts/"]
|
||||||
|
COPY ["module/bbs/NPin.Framework.Bbs.Application/NPin.Framework.Bbs.Application.csproj", "module/bbs/NPin.Framework.Bbs.Application/"]
|
||||||
|
COPY ["module/rbac/NPin.Framework.Rbac.Application/NPin.Framework.Rbac.Application.csproj", "module/rbac/NPin.Framework.Rbac.Application/"]
|
||||||
|
COPY ["module/rbac/NPin.Framework.Rbac.Application.Contracts/NPin.Framework.Rbac.Application.Contracts.csproj", "module/rbac/NPin.Framework.Rbac.Application.Contracts/"]
|
||||||
|
COPY ["module/rbac/NPin.Framework.Rbac.Domain.Shared/NPin.Framework.Rbac.Domain.Shared.csproj", "module/rbac/NPin.Framework.Rbac.Domain.Shared/"]
|
||||||
|
COPY ["framework/NPin.Framework.Mapster/NPin.Framework.Mapster.csproj", "framework/NPin.Framework.Mapster/"]
|
||||||
|
COPY ["framework/NPin.Framework.SqlSugarCore.Abstractions/NPin.Framework.SqlSugarCore.Abstractions.csproj", "framework/NPin.Framework.SqlSugarCore.Abstractions/"]
|
||||||
|
COPY ["module/rbac/NPin.Framework.Rbac.Domain/NPin.Framework.Rbac.Domain.csproj", "module/rbac/NPin.Framework.Rbac.Domain/"]
|
||||||
|
COPY ["module/bbs/NPin.Framework.Bbs.Application.Contracts/NPin.Framework.Bbs.Application.Contracts.csproj", "module/bbs/NPin.Framework.Bbs.Application.Contracts/"]
|
||||||
|
COPY ["module/bbs/NPin.Framework.Bbs.Domain.Shared/NPin.Framework.Bbs.Domain.Shared.csproj", "module/bbs/NPin.Framework.Bbs.Domain.Shared/"]
|
||||||
|
COPY ["module/bbs/NPin.Framework.Bbs.Domain/NPin.Framework.Bbs.Domain.csproj", "module/bbs/NPin.Framework.Bbs.Domain/"]
|
||||||
|
COPY ["src/NPin.Application.Contracts/NPin.Application.Contracts.csproj", "src/NPin.Application.Contracts/"]
|
||||||
|
COPY ["src/NPin.Domain.Shared/NPin.Domain.Shared.csproj", "src/NPin.Domain.Shared/"]
|
||||||
|
COPY ["src/NPin.Domain/NPin.Domain.csproj", "src/NPin.Domain/"]
|
||||||
|
COPY ["src/NPin.SqlSugarCore/NPin.SqlSugarCore.csproj", "src/NPin.SqlSugarCore/"]
|
||||||
|
COPY ["framework/NPin.Framework.SqlSugarCore/NPin.Framework.SqlSugarCore.csproj", "framework/NPin.Framework.SqlSugarCore/"]
|
||||||
|
COPY ["module/bbs/NPin.Framework.Bbs.SqlSugarCore/NPin.Framework.Bbs.SqlSugarCore.csproj", "module/bbs/NPin.Framework.Bbs.SqlSugarCore/"]
|
||||||
|
COPY ["module/rbac/NPin.Framework.Rbac.SqlSugarCore/NPin.Framework.Rbac.SqlSugarCore.csproj", "module/rbac/NPin.Framework.Rbac.SqlSugarCore/"]
|
||||||
|
RUN dotnet restore "./src/NPin.Web/./NPin.Web.csproj"
|
||||||
COPY . .
|
COPY . .
|
||||||
WORKDIR "/src/NPin"
|
WORKDIR "/src/src/NPin.Web"
|
||||||
RUN dotnet build "NPin.csproj" -c Release -o /app/build
|
RUN dotnet build "./NPin.Web.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
|
||||||
FROM build AS publish
|
FROM build AS publish
|
||||||
RUN dotnet publish "NPin.csproj" -c Release -o /app/publish
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
RUN dotnet publish "./NPin.Web.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
FROM base AS final
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=publish /app/publish .
|
COPY --from=publish /app/publish .
|
||||||
ENTRYPOINT ["dotnet", "NPin.dll"]
|
ENTRYPOINT ["dotnet", "NPin.Web.dll"]
|
@ -1,17 +1,45 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<InvariantGlobalization>true</InvariantGlobalization>
|
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
<RootNamespace>NPin</RootNamespace>
|
<DockerfileContext>..\..</DockerfileContext>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Import Project="..\..\common.props"/>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.2"/>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.1"/>
|
||||||
|
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1"/>
|
||||||
|
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0"/>
|
||||||
|
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="8.0.3"/>
|
||||||
|
<PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="8.0.3"/>
|
||||||
|
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="8.0.3"/>
|
||||||
|
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.0.3"/>
|
||||||
|
<PackageReference Include="Volo.Abp.Autofac" Version="8.0.3"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\Framework\NPin.Framework.AspNetCore.Authentication.OAuth\NPin.Framework.AspNetCore.Authentication.OAuth.csproj"/>
|
||||||
|
<ProjectReference Include="..\..\Framework\NPin.Framework.AspNetCore\NPin.Framework.AspNetCore.csproj"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Update="appsettings.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Update="wwwroot\icon\**">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="wwwroot\icon\"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.1" />
|
<None Update="ip2region.db">
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,44 +1,42 @@
|
|||||||
var builder = WebApplication.CreateBuilder(args);
|
|
||||||
|
|
||||||
// Add services to the container.
|
using NPin;
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
using Serilog;
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
using Serilog.Events;
|
||||||
builder.Services.AddSwaggerGen();
|
|
||||||
|
// 创建日志
|
||||||
var app = builder.Build();
|
Log.Logger = new LoggerConfiguration()
|
||||||
|
.MinimumLevel.Debug()
|
||||||
// Configure the HTTP request pipeline.
|
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
|
||||||
if (app.Environment.IsDevelopment())
|
.MinimumLevel.Override("Microsoft.AspNetCore.Hosting.Diagnostics", LogEventLevel.Error)
|
||||||
|
.MinimumLevel.Override("Quartz", LogEventLevel.Warning)
|
||||||
|
// 可使用{SourceContext}记录
|
||||||
|
.Enrich.FromLogContext()
|
||||||
|
.WriteTo.Async(c => c.File("logs/log-.txt", rollingInterval: RollingInterval.Day,
|
||||||
|
restrictedToMinimumLevel: LogEventLevel.Debug))
|
||||||
|
.WriteTo.Async(c => c.File("logs/error-.txt", rollingInterval: RollingInterval.Day,
|
||||||
|
restrictedToMinimumLevel: LogEventLevel.Error))
|
||||||
|
.WriteTo.Async(c => c.Console())
|
||||||
|
.CreateLogger();
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
app.UseSwagger();
|
Log.Information("NPin-Framework (Abp.vNext) 启动!");
|
||||||
app.UseSwaggerUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
builder.WebHost.UseUrls(builder.Configuration["App:SelfUrl"]);
|
||||||
|
builder.Host.UseAutofac();
|
||||||
|
builder.Host.UseSerilog();
|
||||||
|
|
||||||
var summaries = new[]
|
await builder.Services.AddApplicationAsync<NPinWebModule>();
|
||||||
|
var app = builder.Build();
|
||||||
|
await app.InitializeApplicationAsync();
|
||||||
|
await app.RunAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
Log.Fatal(ex, "NPin-Framework (Abp.vNext) 爆炸!");
|
||||||
};
|
}
|
||||||
|
finally
|
||||||
app.MapGet("/weatherforecast", () =>
|
|
||||||
{
|
|
||||||
var forecast = Enumerable.Range(1, 5).Select(index =>
|
|
||||||
new WeatherForecast
|
|
||||||
(
|
|
||||||
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
|
||||||
Random.Shared.Next(-20, 55),
|
|
||||||
summaries[Random.Shared.Next(summaries.Length)]
|
|
||||||
))
|
|
||||||
.ToArray();
|
|
||||||
return forecast;
|
|
||||||
})
|
|
||||||
.WithName("GetWeatherForecast")
|
|
||||||
.WithOpenApi();
|
|
||||||
|
|
||||||
app.Run();
|
|
||||||
|
|
||||||
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
|
|
||||||
{
|
{
|
||||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
Log.CloseAndFlush();
|
||||||
}
|
}
|
@ -1,9 +1,24 @@
|
|||||||
{
|
{
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
// "Default": "Information",
|
||||||
|
"Default": "Debug",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*",
|
||||||
|
"App": {
|
||||||
|
"SelfUrl": "http://*:19001",
|
||||||
|
"CorsOrigins": "http://localhost:19001;http://localhost:18000"
|
||||||
|
},
|
||||||
|
"DbList": [
|
||||||
|
"Sqlite",
|
||||||
|
"Mysql",
|
||||||
|
"Sqlserver",
|
||||||
|
"Oracle",
|
||||||
|
"Postgresql"
|
||||||
|
],
|
||||||
|
"DbConnOptions": {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 94 KiB |
Loading…
Reference in New Issue