From 43b6b89df52630b6bb02e35ec91f37034669d90e Mon Sep 17 00:00:00 2001 From: pi-farm Date: Sat, 27 Sep 2025 20:46:45 +0200 Subject: [PATCH] edit function build_image to load images if no push --- scripts/image-builder.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/scripts/image-builder.sh b/scripts/image-builder.sh index fd0170c..d60f4cd 100755 --- a/scripts/image-builder.sh +++ b/scripts/image-builder.sh @@ -609,15 +609,13 @@ load_project_config() { auto_subversion=$(grep "^auto_subversion=" "$config_file" | cut -d= -f2 || echo "no") } - -# Image bauen # Image bauen build_image() { local project=$1 local config_file="$PROJECT_CONFIG_DIR/$project/config-file" load_project_config "$config_file" - #ensure_logs_dir + ensure_logs_dir local timestamp timestamp=$(date +"%Y%m%d_%H%M%S") local logfile="$LOGS_DIR/${project}_${timestamp}.log" @@ -634,7 +632,7 @@ build_image() { echo "====================================" } | tee "$logfile" - # Architekturen in Buildx-Format umwandeln (linux/arch, getrennt durch Komma) + # Architekturen in Buildx-Format umwandeln (linux/arch, durch Komma getrennt) local platforms platforms=$(echo "$architectures" | xargs -n1 | sed 's|^|linux/|' | paste -sd, -) @@ -643,21 +641,23 @@ build_image() { IFS=',' read -ra regs <<< "$registry" for reg in "${regs[@]}"; do tags+=("-t" "${reg}/${image_name}:${version}") - if [[ "$latest" == "yes" ]]; then - tags+=("-t" "${reg}/${image_name}:latest") - fi + [[ "$latest" == "yes" ]] && tags+=("-t" "${reg}/${image_name}:latest") done - # Push-Flag - local push_flag="" - [[ "$push" == "yes" ]] && push_flag="--push" + # Push oder Load Flag + local driver_flag="" + if [[ "$push" == "yes" ]]; then + driver_flag="--push" + else + driver_flag="--load" + fi { docker buildx build \ --platform "$platforms" \ "${tags[@]}" \ "$PROJECTS_DIR/$project" \ - $push_flag + $driver_flag } 2>&1 | tee -a "$logfile" echo "==== Build beendet: $(date) ====" | tee -a "$logfile" @@ -673,7 +673,6 @@ build_image() { fi } - # Logs ansehen (optional gefiltert nach Projekt) view_logs() { #ensure_logs_dir