[#7] log/master/bind镜像构建支持定制local 用户UID/GID
This commit is contained in:
@@ -46,8 +46,19 @@ while [[ $# -gt 0 ]]; do
|
||||
done
|
||||
|
||||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
. "$root/scripts/common/build_user.sh"
|
||||
|
||||
declare -a build_args=()
|
||||
|
||||
if [[ "$use_intranet" == true ]]; then
|
||||
build_args+=("--build-arg" "USE_INTRANET=true")
|
||||
fi
|
||||
|
||||
cd "$root"
|
||||
|
||||
load_build_user
|
||||
build_args+=("--build-arg" "ARGUS_BUILD_UID=${ARGUS_BUILD_UID}" "--build-arg" "ARGUS_BUILD_GID=${ARGUS_BUILD_GID}")
|
||||
|
||||
master_root="$root/src/master"
|
||||
master_offline_tar="$master_root/offline_wheels.tar.gz"
|
||||
master_offline_dir="$master_root/offline_wheels"
|
||||
@@ -75,12 +86,12 @@ echo "======================================="
|
||||
|
||||
if [[ "$use_intranet" == true ]]; then
|
||||
echo "🌐 Mode: Intranet (Using internal mirror: 10.68.64.1)"
|
||||
build_args="--build-arg USE_INTRANET=true"
|
||||
else
|
||||
echo "🌐 Mode: Public (Using default package sources)"
|
||||
build_args=""
|
||||
fi
|
||||
|
||||
echo "👤 Build user UID:GID -> ${ARGUS_BUILD_UID}:${ARGUS_BUILD_GID}"
|
||||
|
||||
echo "📁 Build context: $root"
|
||||
echo ""
|
||||
|
||||
@@ -88,13 +99,14 @@ build_image() {
|
||||
local image_name=$1
|
||||
local dockerfile_path=$2
|
||||
local tag=$3
|
||||
local extra_args=$4
|
||||
shift 3
|
||||
local extra_args=("$@")
|
||||
|
||||
echo "🔄 Building $image_name image..."
|
||||
echo " Dockerfile: $dockerfile_path"
|
||||
echo " Tag: $tag"
|
||||
|
||||
if docker build $build_args $extra_args -f "$dockerfile_path" -t "$tag" .; then
|
||||
if docker build "${build_args[@]}" "${extra_args[@]}" -f "$dockerfile_path" -t "$tag" .; then
|
||||
echo "✅ $image_name image built successfully"
|
||||
return 0
|
||||
else
|
||||
@@ -106,7 +118,7 @@ build_image() {
|
||||
images_built=()
|
||||
build_failed=false
|
||||
|
||||
if build_image "Elasticsearch" "src/log/elasticsearch/build/Dockerfile" "argus-elasticsearch:latest" ""; then
|
||||
if build_image "Elasticsearch" "src/log/elasticsearch/build/Dockerfile" "argus-elasticsearch:latest"; then
|
||||
images_built+=("argus-elasticsearch:latest")
|
||||
else
|
||||
build_failed=true
|
||||
@@ -114,7 +126,7 @@ fi
|
||||
|
||||
echo ""
|
||||
|
||||
if build_image "Kibana" "src/log/kibana/build/Dockerfile" "argus-kibana:latest" ""; then
|
||||
if build_image "Kibana" "src/log/kibana/build/Dockerfile" "argus-kibana:latest"; then
|
||||
images_built+=("argus-kibana:latest")
|
||||
else
|
||||
build_failed=true
|
||||
@@ -122,7 +134,7 @@ fi
|
||||
|
||||
echo ""
|
||||
|
||||
if build_image "BIND9" "src/bind/build/Dockerfile" "argus-bind9:latest" ""; then
|
||||
if build_image "BIND9" "src/bind/build/Dockerfile" "argus-bind9:latest"; then
|
||||
images_built+=("argus-bind9:latest")
|
||||
else
|
||||
build_failed=true
|
||||
|
||||
Reference in New Issue
Block a user