[#15] 增加镜像构建 --no-cache选项

This commit is contained in:
2025-10-13 15:17:33 +08:00
parent 94b024cc69
commit 2c1586d36d
2 changed files with 21 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ Usage: $0 [OPTIONS]
Options:
--intranet Use intranet mirror for log/bind builds
--master-offline Build master offline image (requires src/master/offline_wheels.tar.gz)
--no-cache Build all images without using Docker layer cache
-h, --help Show this help message
Examples:
@@ -23,6 +24,7 @@ EOF
use_intranet=false
build_master=true
build_master_offline=false
no_cache=false
while [[ $# -gt 0 ]]; do
case $1 in
@@ -39,6 +41,10 @@ while [[ $# -gt 0 ]]; do
build_master_offline=true
shift
;;
--no-cache)
no_cache=true
shift
;;
-h|--help)
show_help
exit 0
@@ -65,6 +71,10 @@ cd "$root"
load_build_user
build_args+=("--build-arg" "ARGUS_BUILD_UID=${ARGUS_BUILD_UID}" "--build-arg" "ARGUS_BUILD_GID=${ARGUS_BUILD_GID}")
if [[ "$no_cache" == true ]]; then
build_args+=("--no-cache")
fi
master_root="$root/src/master"
master_offline_tar="$master_root/offline_wheels.tar.gz"
master_offline_dir="$master_root/offline_wheels"
@@ -159,6 +169,9 @@ if [[ "$build_master" == true ]]; then
if [[ "$build_master_offline" == true ]]; then
master_args+=("--offline")
fi
if [[ "$no_cache" == true ]]; then
master_args+=("--no-cache")
fi
if ./scripts/build_images.sh "${master_args[@]}"; then
if [[ "$build_master_offline" == true ]]; then
images_built+=("argus-master:offline")