[#15] 增加镜像构建 --no-cache选项
This commit is contained in:
parent
ee13c8d094
commit
0e96c5bcb0
@ -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")
|
||||
|
@ -3,12 +3,13 @@ set -euo pipefail
|
||||
|
||||
usage() {
|
||||
cat >&2 <<'USAGE'
|
||||
Usage: $0 [--intranet] [--offline] [--tag <image_tag>]
|
||||
Usage: $0 [--intranet] [--offline] [--tag <image_tag>] [--no-cache]
|
||||
|
||||
Options:
|
||||
--intranet 使用指定的 PyPI 镜像源(默认清华镜像)。
|
||||
--offline 完全离线构建,依赖 offline_wheels/ 目录中的离线依赖包。
|
||||
--tag <image_tag> 自定义镜像标签,默认 argus-master:latest。
|
||||
--no-cache 不使用 Docker 构建缓存。
|
||||
USAGE
|
||||
}
|
||||
|
||||
@ -19,6 +20,7 @@ IMAGE_TAG="${IMAGE_TAG:-argus-master:latest}"
|
||||
DOCKERFILE="src/master/Dockerfile"
|
||||
BUILD_ARGS=()
|
||||
OFFLINE_MODE=0
|
||||
NO_CACHE=0
|
||||
|
||||
source "$PROJECT_ROOT/scripts/common/build_user.sh"
|
||||
load_build_user
|
||||
@ -45,6 +47,11 @@ while [[ "$#" -gt 0 ]]; do
|
||||
IMAGE_TAG="$2"
|
||||
shift 2
|
||||
;;
|
||||
--no-cache)
|
||||
NO_CACHE=1
|
||||
BUILD_ARGS+=("--no-cache")
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user