From 6a83de1f5d259624c4bf7121ae34971b40ab6c3d Mon Sep 17 00:00:00 2001 From: Kleidukos Date: Tue, 12 May 2026 21:46:57 +0200 Subject: [PATCH] Init --- .dockerignore | 25 ++++++++++++++ .gitignore | 42 +++++++++++++++++++++++ OakArchive.sln | 21 ++++++++++++ OakArchive/Dockerfile | 23 +++++++++++++ OakArchive/OakArchive.csproj | 40 +++++++++++++++++++++ OakArchive/Program.cs | 24 +++++++++++++ OakArchive/Properties/launchSettings.json | 14 ++++++++ OakArchive/appsettings.Development.json | 8 +++++ OakArchive/appsettings.json | 9 +++++ compose.yaml | 17 +++++++++ 10 files changed, 223 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 OakArchive.sln create mode 100644 OakArchive/Dockerfile create mode 100644 OakArchive/OakArchive.csproj create mode 100644 OakArchive/Program.cs create mode 100644 OakArchive/Properties/launchSettings.json create mode 100644 OakArchive/appsettings.Development.json create mode 100644 OakArchive/appsettings.json create mode 100644 compose.yaml 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..fbad1b0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,42 @@ +## --- .NET / C# --- +bin/ +obj/ +/TestResults/ +*.suo +*.user +*.userosscache +*.sln.docstates + +## --- JetBrains Rider --- +.idea/ +*.sln.iml +# Falls du Rider-eigene Run-Configurations teilst, +# kannst du die nächste Zeile mit # auskommentieren: +.idea/runConfigurations/ + +## --- Visual Studio --- +.vs/ +[Dd]ebug/ +[Rr]elease/ +x64/ +x86/ + +## --- Docker / Compose --- +# Wir ignorieren lokale Environment-Dateien, die Secrets enthalten könnten +.env +!.env.example + +## --- Datenbank / EF Core --- +# Falls du SQLite zum Testen nutzt (sonst unwichtig für Postgres) +*.db +*.db-shm +*.db-wal + +## --- OS spezifisch --- +.DS_Store +Thumbs.db + +## --- User Secrets (Wichtig für dein Google Auth!) --- +# User Secrets liegen normalerweise außerhalb des Projektordners, +# aber zur Sicherheit: +secrets.json \ No newline at end of file diff --git a/OakArchive.sln b/OakArchive.sln new file mode 100644 index 0000000..ee7d039 --- /dev/null +++ b/OakArchive.sln @@ -0,0 +1,21 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OakArchive", "OakArchive\OakArchive.csproj", "{8FAFD11C-C933-438D-8A95-FC348A8B4E40}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9132EA22-EB6C-448D-A112-85A8D01BDD54}" + 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 + {8FAFD11C-C933-438D-8A95-FC348A8B4E40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8FAFD11C-C933-438D-8A95-FC348A8B4E40}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8FAFD11C-C933-438D-8A95-FC348A8B4E40}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8FAFD11C-C933-438D-8A95-FC348A8B4E40}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/OakArchive/Dockerfile b/OakArchive/Dockerfile new file mode 100644 index 0000000..2ef95a5 --- /dev/null +++ b/OakArchive/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 ["OakArchive/OakArchive.csproj", "OakArchive/"] +RUN dotnet restore "OakArchive/OakArchive.csproj" +COPY . . +WORKDIR "/src/OakArchive" +RUN dotnet build "./OakArchive.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./OakArchive.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "OakArchive.dll"] diff --git a/OakArchive/OakArchive.csproj b/OakArchive/OakArchive.csproj new file mode 100644 index 0000000..7c977dc --- /dev/null +++ b/OakArchive/OakArchive.csproj @@ -0,0 +1,40 @@ + + + + net10.0 + enable + enable + Linux + + + + + .dockerignore + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + diff --git a/OakArchive/Program.cs b/OakArchive/Program.cs new file mode 100644 index 0000000..0ece349 --- /dev/null +++ b/OakArchive/Program.cs @@ -0,0 +1,24 @@ +namespace OakArchive; + +public class Program +{ + public static void Main(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + + // Add services to the container. + + builder.Services.AddControllers(); + + var app = builder.Build(); + + // Configure the HTTP request pipeline. + + app.UseAuthorization(); + + + app.MapControllers(); + + app.Run(); + } +} \ No newline at end of file diff --git a/OakArchive/Properties/launchSettings.json b/OakArchive/Properties/launchSettings.json new file mode 100644 index 0000000..8104a74 --- /dev/null +++ b/OakArchive/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:5050", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/OakArchive/appsettings.Development.json b/OakArchive/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/OakArchive/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/OakArchive/appsettings.json b/OakArchive/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/OakArchive/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..d4c7bd8 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,17 @@ +services: + oakarchive: + image: oakarchive + build: + context: . + dockerfile: OakArchive/Dockerfile + # Falls die DB in einer anderen Datei ist, nimm depends_on raus, + # da Compose nur Services innerhalb derselben Datei überwachen kann. + networks: + - postgres-network + environment: + # WICHTIG: Host muss der 'container_name' oder 'service_name' der DB sein + - CONNECTION_STRING=Host=OmniDB;Database=oak_db;Username=admin;Password=${DB_PASSWORD} + +networks: + postgres-network: + external: true \ No newline at end of file