diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 66cb2c7..e78ebc7 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -1,47 +1,45 @@ -name: .NET Docker Build & Push +name: Docker Image Build & Push on: push: branches: - - 'main' + - 'main' # Baut bei jedem Commit auf main release: - types: [published] + types: [published] # Baut bei jedem neuen Release jobs: - build_and_push: - runs-on: ubuntu-latest # Dein Runner mappt das ja auf Debian Bookworm - container: - image: catthehacker/ubuntu:act-latest # Optional, Standard-Umgebung für den Job selbst + push_to_registry: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read steps: - name: Check out the repo uses: actions/checkout@v4 - # Login in deine Gitea Registry + # 1. Login in die Gitea Container Registry - name: Log in to the Container registry uses: docker/login-action@v3 with: - registry: gitea.penry.de # <-- ANPASSEN (ohne https://) + registry: gitea.penry.de # <-- HIER DEINE GITEA URL ANPASSEN (ohne https://) username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - # Metadaten (Tags generieren: latest, v1.0, etc.) - - name: Extract metadata for Docker + # 2. Metadaten extrahieren (Das ist der magische Teil) + # Er sorgt dafür, dass bei einem Commit das Tag "main" oder "latest" genutzt wird + # und bei einem Release das Tag "v1.2.3" + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 with: - images: gitea.penry.de/${{ github.repository }} # <-- ANPASSEN + images: gitea.penry.de/${{ github.repository }} - # Der eigentliche Build. - # Da wir ein Multi-Stage Dockerfile haben, führt dieser Schritt - # automatisch "dotnet restore" und "dotnet publish" aus. + # 3. Bauen und Pushen - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . - file: ./Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - # Wichtig für Raspberry Pi Builds, falls du Cross-Platform bauen willst (optional) - platforms: linux/arm64 \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/CouchLog/Dockerfile b/CouchLog/Dockerfile deleted file mode 100644 index 9ba07ea..0000000 --- a/CouchLog/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -# --- Stufe 1: Bauen (Build) --- -# Wir nutzen das SDK Image. Da du auf dem Pi bist, zieht Docker automatisch die ARM64 Version. -FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build -WORKDIR /src - -# Wir kopieren erst nur die Projektdatei, um den Cache für "restore" zu nutzen -# ERSETZE "DeinProjektName.csproj" mit dem echten Namen deiner Datei! -COPY ["DeinProjektName.csproj", "./"] -RUN dotnet restore - -# Jetzt den Rest kopieren und bauen -COPY . . -# Wir erstellen die Release-Version im Ordner /app/publish -RUN dotnet publish -c Release -o /app/publish - -# --- Stufe 2: Ausführen (Runtime) --- -# Kleines Image, nur um die App zu starten (kein Compiler mehr drin) -FROM mcr.microsoft.com/dotnet/aspnet:10.0 -WORKDIR /app -EXPOSE 8080 - -# Wir kopieren die fertigen Dateien aus Stufe 1 hierher -COPY --from=build /app/publish . - -# Startbefehl -# ERSETZE "DeinProjektName.dll" mit dem echten Namen (meist gleich wie csproj) -ENTRYPOINT ["dotnet", "CouchLog.dll"] \ No newline at end of file