feat: move distribution builds to platform Docker builder

This commit is contained in:
npc0-hue
2026-07-30 19:25:50 +08:00
parent 1e004dc9ec
commit e614a17fe3
45 changed files with 4492 additions and 294 deletions
+25 -1
View File
@@ -25,11 +25,12 @@ export PLATFORM_BOOTSTRAP_ADMIN_EMAIL="${PLATFORM_BOOTSTRAP_ADMIN_EMAIL:-operato
export PLATFORM_BOOTSTRAP_ADMIN_PASSWORD="${PLATFORM_BOOTSTRAP_ADMIN_PASSWORD:-operator-local}"
export PLATFORM_SECRET_ENVELOPE_KEY="${PLATFORM_SECRET_ENVELOPE_KEY:-local-debug-secret-envelope-key-change-me}"
export PLATFORM_AI_PROVIDER_MODE="${PLATFORM_AI_PROVIDER_MODE:-mock}"
export PLATFORM_RUN_RELEASE_URL="${PLATFORM_RUN_RELEASE_URL:-http://127.0.0.1:$LOCAL_DEBUG_PLATFORM_PORT}"
export RUN_SOURCE_DIR="${RUN_SOURCE_DIR:-${RUN_REPO_DIR:-$LOCAL_DEBUG_ROOT_DIR/run}}"
export RUN_REPO_DIR="$RUN_SOURCE_DIR"
export RUN_MODE="${RUN_MODE:-worker}"
export RUN_PLATFORM_URL="${RUN_PLATFORM_URL:-https://scum.npc0.com:$LOCAL_DEBUG_PLATFORM_PORT}"
export RUN_PLATFORM_URL="${RUN_PLATFORM_URL:-http://127.0.0.1:$LOCAL_DEBUG_PLATFORM_PORT}"
export RUN_ENDPOINT_ID="${RUN_ENDPOINT_ID:-run-local-debug}"
export RUN_DISPLAY_NAME="${RUN_DISPLAY_NAME:-Local Debug Run}"
export RUN_VERSION="${RUN_VERSION:-0.1.0-local-debug}"
@@ -38,6 +39,11 @@ export RUN_WORKSPACE_ROOT="${RUN_WORKSPACE_ROOT:-$LOCAL_DEBUG_ROOT/run/workspace
export RUN_BUILD_BUCKET_ROOT="${RUN_BUILD_BUCKET_ROOT:-$LOCAL_DEBUG_ROOT/run/build-buckets}"
export RUN_BUILD_SOURCE_ROOT="${RUN_BUILD_SOURCE_ROOT:-$RUN_BUILD_BUCKET_ROOT/source/current}"
export RUN_BOOTSTRAP_BIN="${RUN_BOOTSTRAP_BIN:-$RUN_BUILD_BUCKET_ROOT/bootstrap/bin/run}"
export PLATFORM_BUILDER_DOCKER_BINARY="${PLATFORM_BUILDER_DOCKER_BINARY:-docker}"
export PLATFORM_BUILDER_IMAGE="${PLATFORM_BUILDER_IMAGE:-browser-platform-distribution-builder:1.0.0}"
export PLATFORM_BUILDER_SOURCE_DIR="${PLATFORM_BUILDER_SOURCE_DIR:-$RUN_BUILD_SOURCE_ROOT}"
export PLATFORM_BUILDER_WORKSPACE_DIR="${PLATFORM_BUILDER_WORKSPACE_DIR:-$PLATFORM_DATA_DIR/distribution-builds}"
export PLATFORM_BUILDER_TIMEOUT_SECONDS="${PLATFORM_BUILDER_TIMEOUT_SECONDS:-1800}"
export RUN_SPOOL_ROOT="${RUN_SPOOL_ROOT:-$LOCAL_DEBUG_ROOT/run/spool}"
export RUN_MAX_JOBS="${RUN_MAX_JOBS:-1}"
export RUN_HEARTBEAT_INTERVAL_MS="${RUN_HEARTBEAT_INTERVAL_MS:-2000}"
@@ -162,6 +168,24 @@ local_debug_prepare_run_build_source() {
EOF
}
local_debug_prepare_distribution_builder() {
local_debug_prepare_run_build_source
if ! command -v "$PLATFORM_BUILDER_DOCKER_BINARY" >/dev/null 2>&1; then
printf 'platform distribution builder requires %s\n' "$PLATFORM_BUILDER_DOCKER_BINARY" >&2
return 1
fi
if [[ "$PLATFORM_BUILDER_IMAGE" == "browser-platform-distribution-builder:1.0.0" ]]; then
"$PLATFORM_BUILDER_DOCKER_BINARY" build \
-t "$PLATFORM_BUILDER_IMAGE" \
"$LOCAL_DEBUG_ROOT_DIR/platform/distribution-builder"
return
fi
if ! "$PLATFORM_BUILDER_DOCKER_BINARY" image inspect "$PLATFORM_BUILDER_IMAGE" >/dev/null 2>&1; then
printf 'configured platform builder image is not present: %s\n' "$PLATFORM_BUILDER_IMAGE" >&2
return 1
fi
}
local_debug_build_bootstrap_run() {
local_debug_prepare_run_build_source
mkdir -p "$(dirname "$RUN_BOOTSTRAP_BIN")"