Files
gui/scripts/docker-local.sh
T
zeekayandHanzo Dev 69c6e860d7 transplant onto tamagui v2.6.0, brand as a re-runnable transform
This repo could never sync. There was NO merge-base with tamagui — 372 commits
here against 15,791 there, unrelated histories — because it began as a
copy-paste rebrand with a flattened layout. Every "sync" since was a hand
re-application that drifted, which is why the tree sat on 7.3.1 while upstream
shipped fixes we then rediscovered by hand.

This commit's PARENT IS TAMAGUI. A future sync is `git merge tama/main` then
`node scripts/rebrand.mjs` — a real merge, because the history is now shared.

174 packages: 166 upstream, our 8 restored (chrome, shell, telemetry, recipes,
get, font-geist-{sans,mono}, @hanzo/booker), bento-get gained. 170/170 build.

Our patches to files UPSTREAM ALSO OWNS are carried, which the package-level
delta missed and which was where the value actually was:
  - useMedia's server snapshot (`initState ?? getMedia()`). Upstream still
    returns undefined there, so every Tamagui Dialog kills a prerender — the
    exact crash hanzo.app spent a day on.
  - data-slot on web host nodes, absent upstream entirely.
Both applied ONTO upstream's newer files (it rewrote useMedia +150/-63 and
createComponent +160/-55), marked `PATCH (ours, carried across the transplant)`.

Seven traps are encoded in scripts/rebrand.mjs, each found by a gate:
skip itself and lockfiles; special-case the double-branded names in BOTH scoped
and bare form; map path strings, not just paths; drop a level for the flattened
group; check disk rather than a stale index.

Rust build artifacts are NOT committed. An earlier draft of this commit swept
apps/desktop/src-tauri/target/debug in via `git add -A` — 3,859 files including
a 272MB .a, over GitHub's 100MB cap, so the push could never have landed. They
are gitignored now.

Co-Authored-By: Hanzo Dev <[email protected]>
2026-07-30 18:25:06 -07:00

115 lines
2.7 KiB
Bash
Executable File

#!/bin/bash
# build and run docker locally with bento from ../bento
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(dirname "$SCRIPT_DIR")"
PARENT_DIR="$(dirname "$REPO_ROOT")"
REPO_NAME="$(basename "$REPO_ROOT")"
ACTION="${1:-build}"
# check bento exists
if [ ! -d "$PARENT_DIR/bento" ]; then
echo "❌ Error: bento not found at $PARENT_DIR/bento"
exit 1
fi
# load env vars if .env exists (for both build and run)
load_env_file() {
local file="$1"
local prefix="$2"
if [ -f "$file" ]; then
echo "Loading env vars from $file..."
while IFS='=' read -r key value || [ -n "$key" ]; do
# skip comments and empty lines
[[ $key =~ ^#.*$ ]] && continue
[[ -z "$key" ]] && continue
# trim whitespace
key="${key%"${key##*[![:space:]]}"}"
# remove quotes from value
value="${value%\"}"
value="${value#\"}"
value="${value%\'}"
value="${value#\'}"
if [ "$prefix" = "build" ]; then
BUILD_ARGS="$BUILD_ARGS --build-arg $key=$value"
else
RUN_ARGS="$RUN_ARGS -e $key=$value"
fi
done < "$file"
fi
}
if [ "$ACTION" = "run" ]; then
RUN_ARGS=""
# load env for runtime
load_env_file "$REPO_ROOT/.env" "run"
load_env_file "$REPO_ROOT/.env.local" "run"
echo "🚀 Running hanzogui-site on http://localhost:3000"
# use -it only if we have a tty
if [ -t 0 ]; then
docker run -it --rm -p 3000:3000 $RUN_ARGS hanzogui-site
else
docker run --rm -p 3000:3000 $RUN_ARGS hanzogui-site
fi
exit 0
fi
if [ "$ACTION" = "build-run" ]; then
"$0" build && "$0" run
exit 0
fi
# build
echo "📦 Building from $PARENT_DIR with bento..."
# create a .dockerignore in parent to speed up build
PARENT_DOCKERIGNORE="$PARENT_DIR/.dockerignore"
CREATED_DOCKERIGNORE=false
if [ ! -f "$PARENT_DOCKERIGNORE" ]; then
cat > "$PARENT_DOCKERIGNORE" << 'EOF'
.DS_Store
**/node_modules
**/.yarn/install-state.gz
**/dist
**/.turbo
**/.hanzogui
**/.expo
**/ios
**/android
**/.git
EOF
CREATED_DOCKERIGNORE=true
echo "Created temporary .dockerignore in parent"
fi
cleanup() {
if [ "$CREATED_DOCKERIGNORE" = true ] && [ -f "$PARENT_DOCKERIGNORE" ]; then
rm "$PARENT_DOCKERIGNORE"
echo "Cleaned up temporary .dockerignore"
fi
}
trap cleanup EXIT
BUILD_ARGS=""
load_env_file "$REPO_ROOT/.env" "build"
load_env_file "$REPO_ROOT/.env.local" "build"
# build from parent directory
cd "$PARENT_DIR"
docker build \
--progress=plain \
-f "$REPO_NAME/Dockerfile.local" \
$BUILD_ARGS \
-t hanzogui-site \
.
echo ""
echo "✅ Build complete!"
echo ""
echo "Run with: ./scripts/docker-local.sh run"
echo "Or: docker run -it -p 3000:3000 --env-file .env hanzogui-site"