Complete Rebuild of Project from HelloWorld to Blazer WebApp
All checks were successful
Tests / Declarative: Post Actions No test results found
csharp-secdevops-pipeline-pod/pipeline/head This commit looks good

This commit is contained in:
2026-05-12 09:16:44 +02:00
parent e784b7996c
commit 251776b9fd
183 changed files with 644 additions and 8364 deletions

View File

@@ -3,20 +3,28 @@ FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build-env
WORKDIR /app
# 1. Nur Projektdatei kopieren und Abhängigkeiten laden (Nutzt Docker-Caching)
COPY *.sln ./
COPY MyHelloWorld/*.csproj ./MyHelloWorld/
COPY MyHelloWorld.Tests/*.csproj ./MyHelloWorld.Tests/
COPY *.csproj ./
#COPY *.sln ./
#COPY MyHelloWorld/*.csproj ./MyHelloWorld/
#COPY MyHelloWorld.Tests/*.csproj ./MyHelloWorld.Tests/
RUN dotnet restore
# 2. Den restlichen Quellcode kopieren und die App kompilieren
COPY . ./
RUN dotnet publish MyHelloWorld/*.csproj -c Release -o out
#RUN dotnet publish MyHelloWorld/*.csproj -c Release -o out
RUN dotnet publish "SecDevOpsLab.csproj" -c Release -o out
# --- Stage 2: Runtime (Das fertige, schlanke Image) ---
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
WORKDIR /app
# 3. Port für die Web-App öffnen (Standard bei .NET 8 Web-Apps ist 8080)
EXPOSE 8080
ENV ASPNETCORE_URLS=http://+:8080
# 3. Den vorinstallierten User 'app' von Microsoft nutzen
# Erlaube dem User 'app' in das Verzeichnis zu schreiben (für SQLite)
RUN chown -R app:app /app
USER app
# 4. Nur die fertigen Binärdateien aus der Bau-Umgebung rüberschieben