From a5fcfebb12889ccf4ba3402975703ddc717372b5 Mon Sep 17 00:00:00 2001 From: daFeichtl Date: Tue, 7 Apr 2026 17:39:32 +0200 Subject: [PATCH] first commit --- .dockerignore | 25 ++++++++++++++ .gitignore | 5 +++ .idea/.idea.TestApi/.idea/.gitignore | 15 +++++++++ .idea/.idea.TestApi/.idea/encodings.xml | 4 +++ .idea/.idea.TestApi/.idea/indexLayout.xml | 8 +++++ .idea/.idea.TestApi/.idea/vcs.xml | 6 ++++ TestApi.slnx | 6 ++++ TestApi/Dockerfile | 23 +++++++++++++ TestApi/Program.cs | 41 +++++++++++++++++++++++ TestApi/Properties/launchSettings.json | 23 +++++++++++++ TestApi/TestApi.csproj | 20 +++++++++++ TestApi/TestApi.http | 6 ++++ TestApi/appsettings.Development.json | 8 +++++ TestApi/appsettings.json | 9 +++++ 14 files changed, 199 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 .idea/.idea.TestApi/.idea/.gitignore create mode 100644 .idea/.idea.TestApi/.idea/encodings.xml create mode 100644 .idea/.idea.TestApi/.idea/indexLayout.xml create mode 100644 .idea/.idea.TestApi/.idea/vcs.xml create mode 100644 TestApi.slnx create mode 100644 TestApi/Dockerfile create mode 100644 TestApi/Program.cs create mode 100644 TestApi/Properties/launchSettings.json create mode 100644 TestApi/TestApi.csproj create mode 100644 TestApi/TestApi.http create mode 100644 TestApi/appsettings.Development.json create mode 100644 TestApi/appsettings.json 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..add57be --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +bin/ +obj/ +/packages/ +riderModule.iml +/_ReSharper.Caches/ \ No newline at end of file diff --git a/.idea/.idea.TestApi/.idea/.gitignore b/.idea/.idea.TestApi/.idea/.gitignore new file mode 100644 index 0000000..ada8fb5 --- /dev/null +++ b/.idea/.idea.TestApi/.idea/.gitignore @@ -0,0 +1,15 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/contentModel.xml +/.idea.TestApi.iml +/modules.xml +/projectSettingsUpdater.xml +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/.idea.TestApi/.idea/encodings.xml b/.idea/.idea.TestApi/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.TestApi/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.TestApi/.idea/indexLayout.xml b/.idea/.idea.TestApi/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.TestApi/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.TestApi/.idea/vcs.xml b/.idea/.idea.TestApi/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.TestApi/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/TestApi.slnx b/TestApi.slnx new file mode 100644 index 0000000..06c7961 --- /dev/null +++ b/TestApi.slnx @@ -0,0 +1,6 @@ + + + + + + diff --git a/TestApi/Dockerfile b/TestApi/Dockerfile new file mode 100644 index 0000000..4c5a613 --- /dev/null +++ b/TestApi/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 ["TestApi/TestApi.csproj", "TestApi/"] +RUN dotnet restore "TestApi/TestApi.csproj" +COPY . . +WORKDIR "/src/TestApi" +RUN dotnet build "./TestApi.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./TestApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "TestApi.dll"] diff --git a/TestApi/Program.cs b/TestApi/Program.cs new file mode 100644 index 0000000..d5e0ef3 --- /dev/null +++ b/TestApi/Program.cs @@ -0,0 +1,41 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi +builder.Services.AddOpenApi(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.MapOpenApi(); +} + +app.UseHttpsRedirection(); + +var summaries = new[] +{ + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" +}; + +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"); + +app.Run(); + +record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) +{ + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); +} \ No newline at end of file diff --git a/TestApi/Properties/launchSettings.json b/TestApi/Properties/launchSettings.json new file mode 100644 index 0000000..65a440b --- /dev/null +++ b/TestApi/Properties/launchSettings.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "http://localhost:7500", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7044;http://localhost:7500", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/TestApi/TestApi.csproj b/TestApi/TestApi.csproj new file mode 100644 index 0000000..d1a4b55 --- /dev/null +++ b/TestApi/TestApi.csproj @@ -0,0 +1,20 @@ + + + + net10.0 + enable + enable + Linux + + + + + + + + + .dockerignore + + + + diff --git a/TestApi/TestApi.http b/TestApi/TestApi.http new file mode 100644 index 0000000..6ebe96a --- /dev/null +++ b/TestApi/TestApi.http @@ -0,0 +1,6 @@ +@TestApi_HostAddress = http://localhost:7500 + +GET {{TestApi_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/TestApi/appsettings.Development.json b/TestApi/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/TestApi/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/TestApi/appsettings.json b/TestApi/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/TestApi/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}