revert c2eed93e7c
Some checks failed
Docker Image Build & Push / push_to_registry (push) Has been cancelled
Some checks failed
Docker Image Build & Push / push_to_registry (push) Has been cancelled
revert added Dockerfile and adapted build.yaml
This commit is contained in:
@@ -1,47 +1,45 @@
|
|||||||
name: .NET Docker Build & Push
|
name: Docker Image Build & Push
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'main'
|
- 'main' # Baut bei jedem Commit auf main
|
||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published] # Baut bei jedem neuen Release
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_push:
|
push_to_registry:
|
||||||
runs-on: ubuntu-latest # Dein Runner mappt das ja auf Debian Bookworm
|
runs-on: ubuntu-latest
|
||||||
container:
|
permissions:
|
||||||
image: catthehacker/ubuntu:act-latest # Optional, Standard-Umgebung für den Job selbst
|
packages: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out the repo
|
- name: Check out the repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Login in deine Gitea Registry
|
# 1. Login in die Gitea Container 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 # <-- ANPASSEN (ohne https://)
|
registry: gitea.penry.de # <-- HIER DEINE GITEA URL ANPASSEN (ohne https://)
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# Metadaten (Tags generieren: latest, v1.0, etc.)
|
# 2. Metadaten extrahieren (Das ist der magische Teil)
|
||||||
- name: Extract metadata for Docker
|
# 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
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: gitea.penry.de/${{ github.repository }} # <-- ANPASSEN
|
images: gitea.penry.de/${{ github.repository }}
|
||||||
|
|
||||||
# Der eigentliche Build.
|
# 3. Bauen und Pushen
|
||||||
# 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
|
|
||||||
@@ -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"]
|
|
||||||
Reference in New Issue
Block a user