summaryrefslogtreecommitdiff
path: root/scripts/build_sandbox.sh
diff options
context:
space:
mode:
authorBrandon Keiji <[email protected]>2025-05-07 14:23:13 +0000
committerGitHub <[email protected]>2025-05-07 07:23:13 -0700
commit739654bb2559a8c84a926cc955f3593f7c2be179 (patch)
tree4f9806296649769cde508cefc1bbb17425a4b236 /scripts/build_sandbox.sh
parent53448533447604ebfd8604cfcfcbba3e128a0c6a (diff)
fix(sandbox): consolidate dev and prod sandbox (#273)
Diffstat (limited to 'scripts/build_sandbox.sh')
-rwxr-xr-xscripts/build_sandbox.sh41
1 files changed, 13 insertions, 28 deletions
diff --git a/scripts/build_sandbox.sh b/scripts/build_sandbox.sh
index ea87e502..d475f1fb 100755
--- a/scripts/build_sandbox.sh
+++ b/scripts/build_sandbox.sh
@@ -30,10 +30,6 @@ SKIP_NPM_INSTALL_BUILD=false
while getopts "sdf:" opt; do
case ${opt} in
s) SKIP_NPM_INSTALL_BUILD=true ;;
- d)
- DOCKERFILE=Dockerfile-dev
- IMAGE+="-dev"
- ;;
f)
DOCKERFILE=$OPTARG
;;
@@ -54,38 +50,27 @@ if [ "$SKIP_NPM_INSTALL_BUILD" = false ]; then
npm run build --workspaces
fi
-# if using Dockerfile-dev, then skip rebuild unless BUILD_SANDBOX is set
-# rebuild should not be necessary unless Dockerfile-dev is modified
-if [ "$DOCKERFILE" = "Dockerfile-dev" ]; then
- if $CMD images -q "$IMAGE" | grep -q . && [ -z "${BUILD_SANDBOX:-}" ]; then
- echo "using existing $IMAGE (set BUILD_SANDBOX=true to force rebuild)"
- exit 0
- fi
-fi
-
-# prepare global installation files for prod builds (anything but Dockerfile-dev)
-if [ "$DOCKERFILE" != "Dockerfile-dev" ]; then
- # pack cli
- echo "packing @gemini-code/cli ..."
- rm -f packages/cli/dist/gemini-code-cli-*.tgz
- npm pack -w @gemini-code/cli --pack-destination ./packages/cli/dist &>/dev/null
- # pack server
- echo "packing @gemini-code/server ..."
- rm -f packages/server/dist/gemini-code-server-*.tgz
- npm pack -w @gemini-code/server --pack-destination ./packages/server/dist &>/dev/null
- # give node user (used during installation, see Dockerfile) access to these files
- chmod 755 packages/*/dist/gemini-code-*.tgz
-fi
+# prepare global installation files for prod builds
+# pack cli
+echo "packing @gemini-code/cli ..."
+rm -f packages/cli/dist/gemini-code-cli-*.tgz
+npm pack -w @gemini-code/cli --pack-destination ./packages/cli/dist &>/dev/null
+# pack server
+echo "packing @gemini-code/server ..."
+rm -f packages/server/dist/gemini-code-server-*.tgz
+npm pack -w @gemini-code/server --pack-destination ./packages/server/dist &>/dev/null
+# give node user (used during installation, see Dockerfile) access to these files
+chmod 755 packages/*/dist/gemini-code-*.tgz
# build container image & prune older unused images
echo "building $IMAGE ... (can be slow first time)"
if [[ "$CMD" == "podman" ]]; then
# use empty --authfile to skip unnecessary auth refresh overhead
- $CMD build --authfile=<(echo '{}') -f "$DOCKERFILE" -t "$IMAGE" . >/dev/null
+ $CMD build --authfile=<(echo '{}') -f "$DOCKERFILE" -t "$IMAGE" .
elif [[ "$CMD" == "docker" ]]; then
# use an empty config directory to skip unnecessary auth refresh overhead
- $CMD --config="empty" build -f "$DOCKERFILE" -t "$IMAGE" . >/dev/null
+ $CMD --config="empty" buildx build -f "$DOCKERFILE" -t "$IMAGE" .
else
$CMD build -f "$DOCKERFILE" -t "$IMAGE" . >/dev/null
fi