From 646805c6933cf683b260b85bbbce5a5268e8a295 Mon Sep 17 00:00:00 2001 From: bronku Date: Mon, 10 Nov 2025 14:55:25 +0100 Subject: [PATCH] initial --- README.md | 5 +++++ docker-compose.yml | 7 +++++++ dotnet/.dockerignore | 6 ++++++ dotnet/.gitignore | 4 ++++ dotnet/Dockerfile | 8 ++++++++ dotnet/Program.cs | 9 +++++++++ dotnet/dotnet.csproj | 9 +++++++++ 7 files changed, 48 insertions(+) create mode 100644 README.md create mode 100644 docker-compose.yml create mode 100644 dotnet/.dockerignore create mode 100644 dotnet/.gitignore create mode 100644 dotnet/Dockerfile create mode 100644 dotnet/Program.cs create mode 100644 dotnet/dotnet.csproj diff --git a/README.md b/README.md new file mode 100644 index 0000000..8060a0c --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +```sh +git clone +cd +docker compose up -d --build +``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b717ba5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +services: + dotnet: + build: ./dotnet + environment: + - PORT=5000 + ports: + - "5000:5000" diff --git a/dotnet/.dockerignore b/dotnet/.dockerignore new file mode 100644 index 0000000..0bbcc2d --- /dev/null +++ b/dotnet/.dockerignore @@ -0,0 +1,6 @@ +.git +.gitignore +obj +bin +Properties +appsettings* diff --git a/dotnet/.gitignore b/dotnet/.gitignore new file mode 100644 index 0000000..e3450dc --- /dev/null +++ b/dotnet/.gitignore @@ -0,0 +1,4 @@ +obj +bin +Properties +appsettings* diff --git a/dotnet/Dockerfile b/dotnet/Dockerfile new file mode 100644 index 0000000..066f690 --- /dev/null +++ b/dotnet/Dockerfile @@ -0,0 +1,8 @@ +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build + +WORKDIR /src +COPY *.csproj . +RUN dotnet restore + +COPY . . +CMD ["dotnet", "run"] diff --git a/dotnet/Program.cs b/dotnet/Program.cs new file mode 100644 index 0000000..c185af3 --- /dev/null +++ b/dotnet/Program.cs @@ -0,0 +1,9 @@ +var builder = WebApplication.CreateBuilder(args); +var app = builder.Build(); + +var port = Environment.GetEnvironmentVariable("PORT") ?? "5000"; +var url = $"http://0.0.0.0:{port}"; + +app.MapGet("", () => "Hello World!"); + +app.Run(url); diff --git a/dotnet/dotnet.csproj b/dotnet/dotnet.csproj new file mode 100644 index 0000000..1b28a01 --- /dev/null +++ b/dotnet/dotnet.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + +