From bbec747bb707894338c78c901bf8175f40773f12 Mon Sep 17 00:00:00 2001 From: AppFactory Bot Date: Fri, 12 Jun 2026 10:26:56 +0000 Subject: [PATCH] Initial .NET API service --- .dockerignore | 3 +++ Dockerfile | 11 +++++++++++ Idoklad.csproj | 7 +++++++ Program.cs | 22 ++++++++++++++++++++++ README.md | 8 ++++++++ appsettings.json | 9 +++++++++ 6 files changed, 60 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 Idoklad.csproj create mode 100644 Program.cs create mode 100644 README.md create mode 100644 appsettings.json diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..306001a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +bin/ +obj/ +.git/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..02c0539 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +WORKDIR /src +COPY . . +RUN dotnet publish "Idoklad.csproj" -c Release -o /app/publish + +FROM mcr.microsoft.com/dotnet/aspnet:8.0 +WORKDIR /app +ENV ASPNETCORE_URLS=http://+:8080 +EXPOSE 8080 +COPY --from=build /app/publish . +ENTRYPOINT ["dotnet", "Idoklad.dll"] diff --git a/Idoklad.csproj b/Idoklad.csproj new file mode 100644 index 0000000..24ec0e8 --- /dev/null +++ b/Idoklad.csproj @@ -0,0 +1,7 @@ + + + net8.0 + enable + enable + + diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..f2944f3 --- /dev/null +++ b/Program.cs @@ -0,0 +1,22 @@ +var builder = WebApplication.CreateBuilder(args); +var app = builder.Build(); + +var rootPath = Environment.GetEnvironmentVariable("ROOT_PATH"); +if (!string.IsNullOrWhiteSpace(rootPath)) +{ + app.UsePathBase(rootPath); +} + +app.MapGet("/", () => Results.Json(new +{ + name = "iDoklad", + service = "idoklad", + status = "ok" +})); + +app.MapGet("/health", () => Results.Json(new +{ + status = "ok" +})); + +app.Run(); diff --git a/README.md b/README.md new file mode 100644 index 0000000..2e7dda2 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# iDoklad + +.NET API služba vytvořená přes CSBot Services Portal. + +## Endpointy + +- GET / +- GET /health diff --git a/appsettings.json b/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}