diff options
| author | Olcan <[email protected]> | 2025-05-07 11:00:48 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-07 11:00:48 -0700 |
| commit | 46490263123bf855c40da35ef8be62f2b9b134b2 (patch) | |
| tree | 2cb9d0735aae44aa41cbda53d2fe2336be7c627e /scripts | |
| parent | f5b31fcd29898372c69345c3032ee9ae2cfd2c91 (diff) | |
make sandbox build quiet by default but allow VERBOSE=1 option. enable caching by default but allow disabling via BUILD_SANDBOX_FLAGS="--no-cache" (#278)
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/build_sandbox.sh | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/build_sandbox.sh b/scripts/build_sandbox.sh index 1fedcd53..9610cccd 100755 --- a/scripts/build_sandbox.sh +++ b/scripts/build_sandbox.sh @@ -65,14 +65,26 @@ chmod 755 packages/*/dist/gemini-code-*.tgz # build container image & prune older unused images echo "building $IMAGE ... (can be slow first time)" +# redirect build output to /dev/null unless VERBOSE is set +BUILD_STDOUT="/dev/null" +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:-}" + +# append common build args +build_args+=(-f "$DOCKERFILE" -t "$IMAGE" .) + if [[ "$CMD" == "podman" ]]; then # use empty --authfile to skip unnecessary auth refresh overhead - $CMD build --authfile=<(echo '{}') --no-cache -f "$DOCKERFILE" -t "$IMAGE" . + $CMD build --authfile=<(echo '{}') "${build_args[@]}" >$BUILD_STDOUT elif [[ "$CMD" == "docker" ]]; then # use config directory to skip unnecessary auth refresh overhead - $CMD --config=".docker" buildx build --no-cache -f "$DOCKERFILE" -t "$IMAGE" . + $CMD --config=".docker" buildx build "${build_args[@]}" >$BUILD_STDOUT else - $CMD build -f "$DOCKERFILE" -t "$IMAGE" . >/dev/null + $CMD build "${build_args[@]}" >$BUILD_STDOUT fi $CMD image prune -f >/dev/null echo "built $IMAGE" |
