fix: Docker container build command parsing
- Fix docker_run_build to properly extract script path from full command - Separate script path from arguments for chmod execution - Prevents chmod errors when passing arguments to build script
This commit is contained in:
@@ -152,26 +152,29 @@ function docker_start_rootless() {
|
|||||||
|
|
||||||
# Run build command in container
|
# Run build command in container
|
||||||
function docker_run_build() {
|
function docker_run_build() {
|
||||||
local build_script="${1:-./scripts/build.sh}"
|
local build_command="${1:-./scripts/build.sh}"
|
||||||
local image="${2:-${BUILDER_IMAGE}}"
|
local image="${2:-${BUILDER_IMAGE}}"
|
||||||
|
|
||||||
section_header "Running Build in Container"
|
section_header "Running Build in Container"
|
||||||
|
|
||||||
|
# Extract script path from command (first part before any arguments)
|
||||||
|
local script_path=$(echo "$build_command" | cut -d' ' -f1)
|
||||||
|
|
||||||
# Ensure build script is executable
|
# Ensure build script is executable
|
||||||
safe_execute chmod +x "${PROJECT_ROOT}/${build_script}"
|
safe_execute chmod +x "${PROJECT_ROOT}/${script_path}"
|
||||||
|
|
||||||
# Setup container arguments
|
# Setup container arguments
|
||||||
local user_args="--user $(id -u):$(id -g)"
|
local user_args="--user $(id -u):$(id -g)"
|
||||||
local volume_args="-v ${PROJECT_ROOT}:/workspace"
|
local volume_args="-v ${PROJECT_ROOT}:/workspace"
|
||||||
local work_args="-w /workspace"
|
local work_args="-w /workspace"
|
||||||
|
|
||||||
log_info "Executing build script in container: ${build_script}"
|
log_info "Executing build command in container: ${build_command}"
|
||||||
safe_execute ${CONTAINER_RUNTIME} run --rm \
|
safe_execute ${CONTAINER_RUNTIME} run --rm \
|
||||||
${user_args} \
|
${user_args} \
|
||||||
${volume_args} \
|
${volume_args} \
|
||||||
${work_args} \
|
${work_args} \
|
||||||
"${image}" \
|
"${image}" \
|
||||||
${build_script}
|
${build_command}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Commit container state for reuse
|
# Commit container state for reuse
|
||||||
|
|||||||
Reference in New Issue
Block a user