edit function build_image to load images if no push
This commit is contained in:
@@ -609,15 +609,13 @@ load_project_config() {
|
|||||||
auto_subversion=$(grep "^auto_subversion=" "$config_file" | cut -d= -f2 || echo "no")
|
auto_subversion=$(grep "^auto_subversion=" "$config_file" | cut -d= -f2 || echo "no")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Image bauen
|
|
||||||
# Image bauen
|
# Image bauen
|
||||||
build_image() {
|
build_image() {
|
||||||
local project=$1
|
local project=$1
|
||||||
local config_file="$PROJECT_CONFIG_DIR/$project/config-file"
|
local config_file="$PROJECT_CONFIG_DIR/$project/config-file"
|
||||||
load_project_config "$config_file"
|
load_project_config "$config_file"
|
||||||
|
|
||||||
#ensure_logs_dir
|
ensure_logs_dir
|
||||||
local timestamp
|
local timestamp
|
||||||
timestamp=$(date +"%Y%m%d_%H%M%S")
|
timestamp=$(date +"%Y%m%d_%H%M%S")
|
||||||
local logfile="$LOGS_DIR/${project}_${timestamp}.log"
|
local logfile="$LOGS_DIR/${project}_${timestamp}.log"
|
||||||
@@ -634,7 +632,7 @@ build_image() {
|
|||||||
echo "===================================="
|
echo "===================================="
|
||||||
} | tee "$logfile"
|
} | tee "$logfile"
|
||||||
|
|
||||||
# Architekturen in Buildx-Format umwandeln (linux/arch, getrennt durch Komma)
|
# Architekturen in Buildx-Format umwandeln (linux/arch, durch Komma getrennt)
|
||||||
local platforms
|
local platforms
|
||||||
platforms=$(echo "$architectures" | xargs -n1 | sed 's|^|linux/|' | paste -sd, -)
|
platforms=$(echo "$architectures" | xargs -n1 | sed 's|^|linux/|' | paste -sd, -)
|
||||||
|
|
||||||
@@ -643,21 +641,23 @@ 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}")
|
||||||
if [[ "$latest" == "yes" ]]; then
|
[[ "$latest" == "yes" ]] && tags+=("-t" "${reg}/${image_name}:latest")
|
||||||
tags+=("-t" "${reg}/${image_name}:latest")
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Push-Flag
|
# Push oder Load Flag
|
||||||
local push_flag=""
|
local driver_flag=""
|
||||||
[[ "$push" == "yes" ]] && push_flag="--push"
|
if [[ "$push" == "yes" ]]; then
|
||||||
|
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" \
|
||||||
$push_flag
|
$driver_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"
|
||||||
@@ -673,7 +673,6 @@ build_image() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Logs ansehen (optional gefiltert nach Projekt)
|
# Logs ansehen (optional gefiltert nach Projekt)
|
||||||
view_logs() {
|
view_logs() {
|
||||||
#ensure_logs_dir
|
#ensure_logs_dir
|
||||||
|
|||||||
Reference in New Issue
Block a user