edit function build_image

This commit is contained in:
2025-09-27 20:53:10 +02:00
parent 6344bab5ce
commit 1b4d9fedd5

View File

@@ -632,7 +632,7 @@ build_image() {
echo "===================================="
} | tee "$logfile"
# Architekturen in Buildx-Format umwandeln (linux/arch, durch Komma getrennt)
# Architekturen in Buildx-Format umwandeln (linux/arch, getrennt durch Komma)
local platforms
platforms=$(echo "$architectures" | xargs -n1 | sed 's|^|linux/|' | paste -sd, -)
@@ -641,23 +641,21 @@ build_image() {
IFS=',' read -ra regs <<< "$registry"
for reg in "${regs[@]}"; do
tags+=("-t" "${reg}/${image_name}:${version}")
[[ "$latest" == "yes" ]] && tags+=("-t" "${reg}/${image_name}:latest")
if [[ "$latest" == "yes" ]]; then
tags+=("-t" "${reg}/${image_name}:latest")
fi
done
# Push oder Load Flag
local driver_flag=""
if [[ "$push" == "yes" ]]; then
driver_flag="--push"
else
driver_flag="--load"
fi
# Push-Flag
local push_flag=""
[[ "$push" == "yes" ]] && push_flag="--push"
{
docker buildx build \
--platform "$platforms" \
"${tags[@]}" \
"$PROJECTS_DIR/$project" \
$driver_flag
$push_flag
} 2>&1 | tee -a "$logfile"
echo "==== Build beendet: $(date) ====" | tee -a "$logfile"