diff options
| author | Olcan <[email protected]> | 2025-06-05 13:02:56 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-05 13:02:56 -0700 |
| commit | d3e43437a00cfe64790cc60c9c8aa82c85f520c3 (patch) | |
| tree | f741d5a857f00c5b6302e1cf306d0264d5e69f27 /scripts | |
| parent | e02868bb1a7f62c63e99ba4108e3e8cef3c8108c (diff) | |
use execSync (vs spawnSync) so launch fails if build_sandbox fails; tweaks in build_sandbox to fix some shellcheck warnings, and to simplify the logic slightly (#767)
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/build_sandbox.sh | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/scripts/build_sandbox.sh b/scripts/build_sandbox.sh index 4366cd45..151c8284 100755 --- a/scripts/build_sandbox.sh +++ b/scripts/build_sandbox.sh @@ -76,36 +76,26 @@ if [ -n "${VERBOSE:-}" ]; then BUILD_STDOUT="/dev/stdout" fi -# initialize build arg array from BUILD_SANDBOX_FLAGS -read -r -a build_args <<<"${BUILD_SANDBOX_FLAGS:-}" - build_image() { - local -n build_args=$1 - if [[ "$CMD" == "podman" ]]; then # use empty --authfile to skip unnecessary auth refresh overhead - $CMD build --authfile=<(echo '{}') "${build_args[@]}" >$BUILD_STDOUT + $CMD build --authfile=<(echo '{}') "$@" >$BUILD_STDOUT elif [[ "$CMD" == "docker" ]]; then - # use config directory to skip unnecessary auth refresh overhead - $CMD --config=".docker" buildx build "${build_args[@]}" >$BUILD_STDOUT + $CMD --config=".docker" buildx build "$@" >$BUILD_STDOUT else - $CMD build "${build_args[@]}" >$BUILD_STDOUT + $CMD build "$@" >$BUILD_STDOUT fi } -# build container images & prune older unused images - echo "building $BASE_IMAGE ... (can be slow first time)" -base_image_build_args=(${build_args[@]}) -base_image_build_args+=(-f "$BASE_DOCKERFILE" -t "$BASE_IMAGE" .) -build_image base_image_build_args +# shellcheck disable=SC2086 # allow globbing and word splitting for BUILD_SANDBOX_FLAGS +build_image ${BUILD_SANDBOX_FLAGS:-} -f "$BASE_DOCKERFILE" -t "$BASE_IMAGE" . echo "built $BASE_IMAGE" if [[ -n "$CUSTOM_DOCKERFILE" && -n "$CUSTOM_IMAGE" ]]; then echo "building $CUSTOM_IMAGE ... (can be slow first time)" - custom_image_build_args=(${build_args[@]}) - custom_image_build_args+=(-f "$CUSTOM_DOCKERFILE" -t "$CUSTOM_IMAGE" .) - build_image custom_image_build_args + # shellcheck disable=SC2086 # allow globbing and word splitting for BUILD_SANDBOX_FLAGS + build_image ${BUILD_SANDBOX_FLAGS:-} -f "$CUSTOM_DOCKERFILE" -t "$CUSTOM_IMAGE" . echo "built $CUSTOM_IMAGE" fi |
