Switch code, scripts and docs to English; drop plan.md references
This commit is contained in:
1 parent
76f1ad7825
commit
c4c7ca2ee4
15 files changed
+532
-540
No files matched your search
+22
-22
@@ -1,55 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
# Baut das Produktiv-Image aus dem aktuellen main-Stand und pusht es in die
|
||||
# Gitea-Registry, getaggt mit :latest UND dem Commit-Kurz-SHA (Rollback).
|
||||
# Builds the production image from the current main state and pushes it to the
|
||||
# Gitea registry, tagged with :latest AND the short commit SHA (rollback).
|
||||
#
|
||||
# Nur fuer freigegebene Staende: das Skript verweigert den Push, wenn du nicht
|
||||
# auf main bist oder uncommittete Aenderungen hast. Fuer Dev-Builds ohne Push
|
||||
# stattdessen scripts/dev-build.sh nutzen.
|
||||
# For approved states only: the script refuses to push if you are not on main
|
||||
# or have uncommitted changes. For dev builds without a push use
|
||||
# scripts/dev-build.sh instead.
|
||||
#
|
||||
# Voraussetzung: einmalig `docker login gitea.anticarnist.de` (siehe
|
||||
# Prerequisite: a one-time `docker login gitea.anticarnist.de` (see
|
||||
# docs/deployment.md).
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
IMAGE="gitea.anticarnist.de/tom/elternbeirat"
|
||||
|
||||
# Ins Repo-Root wechseln (Skript liegt in scripts/), damit der Docker-Build-
|
||||
# Kontext stimmt, egal von wo aufgerufen.
|
||||
# Change into the repo root (the script lives in scripts/) so the Docker build
|
||||
# context is correct no matter where it is called from.
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||
if [[ "$branch" != "main" ]]; then
|
||||
echo "ABBRUCH: du bist auf '$branch', nicht auf 'main'." >&2
|
||||
echo "Ein :latest-Release darf nur aus main gebaut werden." >&2
|
||||
echo "Fuer einen Dev-Build ohne Push: scripts/dev-build.sh" >&2
|
||||
echo "ABORT: you are on '$branch', not on 'main'." >&2
|
||||
echo "A :latest release may only be built from main." >&2
|
||||
echo "For a dev build without a push: scripts/dev-build.sh" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "$(git status --porcelain)" ]]; then
|
||||
echo "ABBRUCH: Arbeitsverzeichnis nicht sauber (uncommittete Aenderungen)." >&2
|
||||
echo "Erst committen, damit der SHA-Tag den Image-Inhalt eindeutig benennt." >&2
|
||||
echo "ABORT: working tree is not clean (uncommitted changes)." >&2
|
||||
echo "Commit first so the SHA tag names the image content unambiguously." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Warnung, wenn lokaler main dem Remote voraus ist (ungepushte Commits) — dann
|
||||
# wuerde ein SHA getaggt, den es auf Gitea noch nicht gibt.
|
||||
# Warn if the local main is ahead of the remote (unpushed commits) -- otherwise
|
||||
# a SHA would be tagged that does not yet exist on Gitea.
|
||||
if git rev-parse --verify --quiet origin/main >/dev/null; then
|
||||
ahead="$(git rev-list --count origin/main..HEAD)"
|
||||
if [[ "$ahead" -gt 0 ]]; then
|
||||
echo "WARNUNG: lokaler main ist origin/main um $ahead Commit(s) voraus." >&2
|
||||
echo " Erst 'git push', damit der SHA auf Gitea existiert." >&2
|
||||
read -r -p "Trotzdem fortfahren? [y/N] " answer
|
||||
echo "WARNING: local main is ahead of origin/main by $ahead commit(s)." >&2
|
||||
echo " Run 'git push' first so the SHA exists on Gitea." >&2
|
||||
read -r -p "Continue anyway? [y/N] " answer
|
||||
[[ "$answer" == "y" || "$answer" == "Y" ]] || exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
sha="$(git rev-parse --short HEAD)"
|
||||
echo "Baue $IMAGE (Tags: latest, $sha)"
|
||||
echo "Building $IMAGE (tags: latest, $sha)"
|
||||
|
||||
docker build -t "$IMAGE:latest" -t "$IMAGE:$sha" .
|
||||
docker push "$IMAGE" --all-tags
|
||||
|
||||
echo
|
||||
echo "Fertig. Gepusht: $IMAGE:latest und $IMAGE:$sha"
|
||||
echo "Auf Unraid: Stack 'elternbeirat' -> Compose Down/Up (bzw. Pull), damit"
|
||||
echo "das neue :latest gezogen wird."
|
||||
echo "Done. Pushed: $IMAGE:latest and $IMAGE:$sha"
|
||||
echo "On Unraid: stack 'elternbeirat' -> Compose Down/Up (or Pull) so the new"
|
||||
echo ":latest is fetched."
|
||||
Reference in new issue
Block a user