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