From 420bb8a4f9cc6f9f6f4a27260b20eda210619a0d Mon Sep 17 00:00:00 2001 From: BeatriceAl Date: Mon, 11 May 2026 22:01:37 +0200 Subject: [PATCH] added docker for deployment and README for how to --- .dockerignore | 20 +++++++++++++++++ Dockerfile | 22 +++++++++++++++++++ README.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 28 +++++++++++++++++++++++ 4 files changed, 125 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..34521d0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,20 @@ +.git/ +.idea/ +.vs/ +.vscode/ + +**/bin/ +**/obj/ +**/TestResults/ +**/coverage/ + +*.user +*.suo +*.log + +.env +.env.* + +Dockerfile +docker-compose.yml +README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..082bc85 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build +WORKDIR /src + +COPY Guestlist.sln ./ +COPY Guestlist/Guestlist.csproj Guestlist/ +RUN dotnet restore Guestlist.sln + +COPY Guestlist/ Guestlist/ +RUN dotnet publish Guestlist/Guestlist.csproj \ + --configuration Release \ + --no-restore \ + --output /app/publish + +FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime +WORKDIR /app + +ENV ASPNETCORE_URLS=http://+:8080 +EXPOSE 8080 + +COPY --from=build /app/publish ./ + +ENTRYPOINT ["dotnet", "Guestlist.dll"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..a2adb90 --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +# Guestlist + +Minimale Guestlist-App mit Admin/Maintainer-Login, Guest-Access-Code und MongoDB. + +## Schnellstart mit Docker Compose + +```bash +docker compose up -d --build +``` + +App öffnen: + +```text +http://localhost:8080 +``` + +Beim ersten Start: + +```text +http://localhost:8080/setup +``` + +Dort den ersten Admin und den Guest Access Code anlegen. + +## Nützliche Befehle + +Logs anzeigen: + +```bash +docker compose logs -f app +``` + +Stoppen: + +```bash +docker compose down +``` + +Stoppen und MongoDB-Daten löschen: + +```bash +docker compose down -v +``` + +## Konfiguration + +Die App wird im Container über Environment Variables konfiguriert: + +```yaml +Mongo__ConnectionString: mongodb://mongo:27017 +Mongo__DatabaseName: guestlist +ASPNETCORE_URLS: http://+:8080 +``` + +MongoDB-Daten liegen im Compose-Volume `mongo_data`. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..413587b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ +services: + app: + build: + context: . + dockerfile: Dockerfile + container_name: guestlist-app + restart: unless-stopped + ports: + - "8080:8080" + environment: + ASPNETCORE_ENVIRONMENT: Production + ASPNETCORE_URLS: http://+:8080 + Mongo__ConnectionString: mongodb://mongo:27017 + Mongo__DatabaseName: guestlist + depends_on: + - mongo + + mongo: + image: mongo:7 + container_name: guestlist-mongo + restart: unless-stopped + volumes: + - mongo_data:/data/db + ports: + - "27017:27017" + +volumes: + mongo_data: