commit 2c9326dee1c1f9dde6ab79b4d7d1d45cc26bfbad Author: Mohammad Mahdi Date: Tue Aug 19 21:14:03 2025 +0330 Initial commit diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..cd967fc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/.idea +**/*.*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 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..91953df --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +bin/ +obj/ +/packages/ +riderModule.iml +/_ReSharper.Caches/ +.idea \ No newline at end of file diff --git a/VirtualDDNSRouter.Server/Dockerfile b/VirtualDDNSRouter.Server/Dockerfile new file mode 100644 index 0000000..8af791e --- /dev/null +++ b/VirtualDDNSRouter.Server/Dockerfile @@ -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"] diff --git a/VirtualDDNSRouter.Server/Program.cs b/VirtualDDNSRouter.Server/Program.cs new file mode 100644 index 0000000..0c18261 --- /dev/null +++ b/VirtualDDNSRouter.Server/Program.cs @@ -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 +{ +} \ No newline at end of file diff --git a/VirtualDDNSRouter.Server/VirtualDDNSRouter.Server.csproj b/VirtualDDNSRouter.Server/VirtualDDNSRouter.Server.csproj new file mode 100644 index 0000000..7913330 --- /dev/null +++ b/VirtualDDNSRouter.Server/VirtualDDNSRouter.Server.csproj @@ -0,0 +1,24 @@ + + + + net10.0 + enable + enable + true + true + true + Linux + + + + + + + + + + .dockerignore + + + + diff --git a/VirtualDDNSRouter.Server/VirtualDDNSRouter.Server.http b/VirtualDDNSRouter.Server/VirtualDDNSRouter.Server.http new file mode 100644 index 0000000..7e7d060 --- /dev/null +++ b/VirtualDDNSRouter.Server/VirtualDDNSRouter.Server.http @@ -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 + +### diff --git a/VirtualDDNSRouter.Server/appsettings.Development.json b/VirtualDDNSRouter.Server/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/VirtualDDNSRouter.Server/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/VirtualDDNSRouter.Server/appsettings.json b/VirtualDDNSRouter.Server/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/VirtualDDNSRouter.Server/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/VirtualDDNSRouter.sln b/VirtualDDNSRouter.sln new file mode 100644 index 0000000..18ca1eb --- /dev/null +++ b/VirtualDDNSRouter.sln @@ -0,0 +1,21 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtualDDNSRouter.Server", "VirtualDDNSRouter.Server\VirtualDDNSRouter.Server.csproj", "{6101BFD3-C31C-41CB-9402-A8B9F3EBEE22}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{23F7EF5B-E175-4E0B-AA3B-51A9496E34B4}" + ProjectSection(SolutionItems) = preProject + compose.yaml = compose.yaml + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6101BFD3-C31C-41CB-9402-A8B9F3EBEE22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6101BFD3-C31C-41CB-9402-A8B9F3EBEE22}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6101BFD3-C31C-41CB-9402-A8B9F3EBEE22}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6101BFD3-C31C-41CB-9402-A8B9F3EBEE22}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..56ef1ee --- /dev/null +++ b/compose.yaml @@ -0,0 +1,7 @@ +services: + virtualddnsrouter.server: + image: virtualddnsrouter.server + build: + context: . + dockerfile: VirtualDDNSRouter.Server/Dockerfile +