Initial commit
This commit is contained in:
23
VirtualDDNSRouter.Server/Dockerfile
Normal file
23
VirtualDDNSRouter.Server/Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
||||
USER $APP_UID
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
EXPOSE 8081
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["VirtualDDNSRouter.Server/VirtualDDNSRouter.Server.csproj", "VirtualDDNSRouter.Server/"]
|
||||
RUN dotnet restore "VirtualDDNSRouter.Server/VirtualDDNSRouter.Server.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/VirtualDDNSRouter.Server"
|
||||
RUN dotnet build "./VirtualDDNSRouter.Server.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./VirtualDDNSRouter.Server.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "VirtualDDNSRouter.Server.dll"]
|
29
VirtualDDNSRouter.Server/Program.cs
Normal file
29
VirtualDDNSRouter.Server/Program.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
|
||||
var builder = WebApplication.CreateSlimBuilder(args);
|
||||
|
||||
builder.Services.ConfigureHttpJsonOptions(options =>
|
||||
{
|
||||
options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonSerializerContext.Default);
|
||||
});
|
||||
|
||||
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||
builder.Services.AddOpenApi();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.MapOpenApi();
|
||||
}
|
||||
|
||||
|
||||
|
||||
app.Run();
|
||||
|
||||
|
||||
[JsonSerializable(typeof(Object))]
|
||||
internal partial class AppJsonSerializerContext : JsonSerializerContext
|
||||
{
|
||||
}
|
24
VirtualDDNSRouter.Server/VirtualDDNSRouter.Server.csproj
Normal file
24
VirtualDDNSRouter.Server/VirtualDDNSRouter.Server.csproj
Normal file
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<PublishAot>true</PublishAot>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0-preview.6.25358.103"/>
|
||||
<PackageReference Include="YamlDotNet" Version="16.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\.dockerignore">
|
||||
<Link>.dockerignore</Link>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
11
VirtualDDNSRouter.Server/VirtualDDNSRouter.Server.http
Normal file
11
VirtualDDNSRouter.Server/VirtualDDNSRouter.Server.http
Normal file
@@ -0,0 +1,11 @@
|
||||
@VirtualDDNSRouter.Server_HostAddress = http://localhost:5277
|
||||
|
||||
GET {{VirtualDDNSRouter.Server_HostAddress}}/todos/
|
||||
Accept: application/json
|
||||
|
||||
###
|
||||
|
||||
GET {{VirtualDDNSRouter.Server_HostAddress}}/todos/1
|
||||
Accept: application/json
|
||||
|
||||
###
|
8
VirtualDDNSRouter.Server/appsettings.Development.json
Normal file
8
VirtualDDNSRouter.Server/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
9
VirtualDDNSRouter.Server/appsettings.json
Normal file
9
VirtualDDNSRouter.Server/appsettings.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
Reference in New Issue
Block a user