added Dockerfile and adapted build.yaml
Some checks failed
.NET Docker Build & Push / build_and_push (push) Failing after 3m53s
Some checks failed
.NET Docker Build & Push / build_and_push (push) Failing after 3m53s
This commit is contained in:
@@ -1,45 +1,47 @@
|
|||||||
name: Docker Image Build & Push
|
name: .NET Docker Build & Push
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'main' # Baut bei jedem Commit auf main
|
- 'main'
|
||||||
release:
|
release:
|
||||||
types: [published] # Baut bei jedem neuen Release
|
types: [published]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
push_to_registry:
|
build_and_push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest # Dein Runner mappt das ja auf Debian Bookworm
|
||||||
permissions:
|
container:
|
||||||
packages: write
|
image: catthehacker/ubuntu:act-latest # Optional, Standard-Umgebung für den Job selbst
|
||||||
contents: read
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out the repo
|
- name: Check out the repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# 1. Login in die Gitea Container Registry
|
# Login in deine Gitea Registry
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: gitea.penry.de # <-- HIER DEINE GITEA URL ANPASSEN (ohne https://)
|
registry: gitea.penry.de # <-- ANPASSEN (ohne https://)
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# 2. Metadaten extrahieren (Das ist der magische Teil)
|
# Metadaten (Tags generieren: latest, v1.0, etc.)
|
||||||
# Er sorgt dafür, dass bei einem Commit das Tag "main" oder "latest" genutzt wird
|
- name: Extract metadata for Docker
|
||||||
# und bei einem Release das Tag "v1.2.3"
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: gitea.penry.de/${{ github.repository }}
|
images: gitea.penry.de/${{ github.repository }} # <-- ANPASSEN
|
||||||
|
|
||||||
# 3. Bauen und Pushen
|
# Der eigentliche Build.
|
||||||
|
# Da wir ein Multi-Stage Dockerfile haben, führt dieser Schritt
|
||||||
|
# automatisch "dotnet restore" und "dotnet publish" aus.
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
# Wichtig für Raspberry Pi Builds, falls du Cross-Platform bauen willst (optional)
|
||||||
|
platforms: linux/arm64
|
||||||
27
CouchLog/Dockerfile
Normal file
27
CouchLog/Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# --- 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"]
|
||||||
Reference in New Issue
Block a user