#!/usr/bin/env bash # Costruisce l'immagine Docker del server con il tag della versione (da Directory.Build.props) # e "latest", poi la pubblica sul registry Gitea. # Uso: RE_REGISTRY=gitea.lan:3000/utente scripts/publish-image.sh [--no-push] set -euo pipefail cd "$(dirname "$0")/.." version="$(sed -n 's:.*\(.*\).*:\1:p' Directory.Build.props | head -n1)" if [ -z "$version" ]; then echo "ERRORE: versione non trovata in Directory.Build.props" >&2 exit 1 fi registry="${RE_REGISTRY:-}" name="rail-enterprise-server" image="${registry:+$registry/}$name" docker build -f docker/Dockerfile -t "$image:$version" -t "$image:latest" . echo "immagine: $image:$version" if [ "${1:-}" = "--no-push" ]; then exit 0 fi if [ -z "$registry" ]; then echo "RE_REGISTRY non impostato: immagine solo locale (usa --no-push per non vedere questo avviso)" >&2 exit 0 fi docker push "$image:$version" docker push "$image:latest"