edit function build_image to load images if no push

This commit is contained in:
2025-09-27 20:46:45 +02:00
parent c4ad216110
commit 43b6b89df5

View File

@@ -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