Files
sultan/deploy/push-image.sh
T
br ca6cdcca63 software steht so weit.
jetzt build + docker build und testen
2026-10-02 13:25:34 +02:00

44 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Baut das Multi-Arch-Image (amd64 + arm64) und schiebt es in die
# Container-Registry von Gitea.
#
# docker login git.everdc.eu # einmalig, Gitea-User + Token mit write:package
# deploy/push-image.sh # Tag aus `git describe`
# LATEST=1 deploy/push-image.sh # zusätzlich :latest setzen (nur für Releases)
#
# Ergebnis: ${REGISTRY}/${OWNER}/sultan:<version> (und ggf. :latest)
set -euo pipefail
cd "$(dirname "$0")/.."
REGISTRY="${REGISTRY:-git.everdc.eu}"
OWNER="${OWNER:-chmln-app-dev}"
IMAGE="${REGISTRY}/${OWNER}/sultan"
VERSION="${VERSION:-$(git describe --tags --always --dirty)}"
PLATFORMS="${PLATFORMS:-linux/amd64,linux/arm64}"
case "$VERSION" in
*-dirty)
echo "Arbeitsverzeichnis hat uncommittete Änderungen (${VERSION}) – erst committen." >&2
exit 1
;;
esac
tags=(-t "${IMAGE}:${VERSION}")
if [ "${LATEST:-0}" = 1 ]; then
tags+=(-t "${IMAGE}:latest")
fi
# Multi-Arch-Builds brauchen einen buildx-Builder mit docker-container-Treiber.
if ! docker buildx inspect sultan-builder >/dev/null 2>&1; then
docker buildx create --name sultan-builder --driver docker-container >/dev/null
fi
docker buildx build --builder sultan-builder \
--platform "$PLATFORMS" \
--build-arg VERSION="$VERSION" \
"${tags[@]}" \
--push .
echo "==> gepusht: ${IMAGE}:${VERSION}"
docker buildx imagetools inspect "${IMAGE}:${VERSION}" | head -n 3