commit 9cb9ad066a27e91f5175a700ad48bb659e8a5b08 Author: Jan Benicek Date: Tue Jul 8 08:23:01 2025 +0200 Init project 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.MultiFile-Server/.idea/.gitignore b/.idea/.idea.MultiFile-Server/.idea/.gitignore new file mode 100644 index 0000000..5dbe026 --- /dev/null +++ b/.idea/.idea.MultiFile-Server/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/.idea.MultiFile-Server.iml +/contentModel.xml +/modules.xml +/projectSettingsUpdater.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.MultiFile-Server/.idea/AndroidProjectSystem.xml b/.idea/.idea.MultiFile-Server/.idea/AndroidProjectSystem.xml new file mode 100644 index 0000000..e82600c --- /dev/null +++ b/.idea/.idea.MultiFile-Server/.idea/AndroidProjectSystem.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.MultiFile-Server/.idea/encodings.xml b/.idea/.idea.MultiFile-Server/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.MultiFile-Server/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.MultiFile-Server/.idea/indexLayout.xml b/.idea/.idea.MultiFile-Server/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.MultiFile-Server/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.MultiFile-Server/.idea/vcs.xml b/.idea/.idea.MultiFile-Server/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.MultiFile-Server/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MultiFile-Server.sln b/MultiFile-Server.sln new file mode 100644 index 0000000..a731b21 --- /dev/null +++ b/MultiFile-Server.sln @@ -0,0 +1,21 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiFile-Server", "MultiFile-Server\MultiFile-Server.csproj", "{843557F4-F6D1-42B7-8CDF-E7C65B4DF053}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7A7EF8A0-8645-4026-92E7-B998E885B6B2}" + 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 + {843557F4-F6D1-42B7-8CDF-E7C65B4DF053}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {843557F4-F6D1-42B7-8CDF-E7C65B4DF053}.Debug|Any CPU.Build.0 = Debug|Any CPU + {843557F4-F6D1-42B7-8CDF-E7C65B4DF053}.Release|Any CPU.ActiveCfg = Release|Any CPU + {843557F4-F6D1-42B7-8CDF-E7C65B4DF053}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/MultiFile-Server/Controllers/WeatherForecastController.cs b/MultiFile-Server/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..d395c40 --- /dev/null +++ b/MultiFile-Server/Controllers/WeatherForecastController.cs @@ -0,0 +1,32 @@ +using Microsoft.AspNetCore.Mvc; + +namespace MultiFile_Server.Controllers; + +[ApiController] +[Route("[controller]")] +public class WeatherForecastController : ControllerBase +{ + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } +} \ No newline at end of file diff --git a/MultiFile-Server/Dockerfile b/MultiFile-Server/Dockerfile new file mode 100644 index 0000000..ea70aac --- /dev/null +++ b/MultiFile-Server/Dockerfile @@ -0,0 +1,23 @@ +FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base +USER $APP_UID +WORKDIR /app +EXPOSE 8080 +EXPOSE 8081 + +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["MultiFile-Server/MultiFile-Server.csproj", "MultiFile-Server/"] +RUN dotnet restore "MultiFile-Server/MultiFile-Server.csproj" +COPY . . +WORKDIR "/src/MultiFile-Server" +RUN dotnet build "./MultiFile-Server.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./MultiFile-Server.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "MultiFile-Server.dll"] diff --git a/MultiFile-Server/MultiFile-Server.csproj b/MultiFile-Server/MultiFile-Server.csproj new file mode 100644 index 0000000..1286b2e --- /dev/null +++ b/MultiFile-Server/MultiFile-Server.csproj @@ -0,0 +1,21 @@ + + + + net9.0 + enable + enable + MultiFile_Server + Linux + + + + + + + + + .dockerignore + + + + diff --git a/MultiFile-Server/MultiFile-Server.http b/MultiFile-Server/MultiFile-Server.http new file mode 100644 index 0000000..5bb2942 --- /dev/null +++ b/MultiFile-Server/MultiFile-Server.http @@ -0,0 +1,6 @@ +@MultiFile_Server_HostAddress = http://localhost:5192 + +GET {{MultiFile_Server_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/MultiFile-Server/Program.cs b/MultiFile-Server/Program.cs new file mode 100644 index 0000000..5627f07 --- /dev/null +++ b/MultiFile-Server/Program.cs @@ -0,0 +1,30 @@ +namespace MultiFile_Server; + +public class Program +{ + public static void Main(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + + // Add services to the container. + + builder.Services.AddControllers(); + // 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.UseAuthorization(); + + + app.MapControllers(); + + app.Run(); + } +} \ No newline at end of file diff --git a/MultiFile-Server/Properties/launchSettings.json b/MultiFile-Server/Properties/launchSettings.json new file mode 100644 index 0000000..a941695 --- /dev/null +++ b/MultiFile-Server/Properties/launchSettings.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "http://localhost:5192", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/MultiFile-Server/WeatherForecast.cs b/MultiFile-Server/WeatherForecast.cs new file mode 100644 index 0000000..4f1bcfb --- /dev/null +++ b/MultiFile-Server/WeatherForecast.cs @@ -0,0 +1,12 @@ +namespace MultiFile_Server; + +public class WeatherForecast +{ + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } +} \ No newline at end of file diff --git a/MultiFile-Server/appsettings.Development.json b/MultiFile-Server/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/MultiFile-Server/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/MultiFile-Server/appsettings.json b/MultiFile-Server/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/MultiFile-Server/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..d4ac7fe --- /dev/null +++ b/compose.yaml @@ -0,0 +1,7 @@ +services: + multifile-server: + image: multifile-server + build: + context: . + dockerfile: MultiFile-Server/Dockerfile +