eleven / messenger Public

build: trim the deploy build context for lean, fast uploads (#139)

deploy-instance.sh copied the whole working tree into the Miren upload —
including ios/ native build output (~700MB) and the Node apps' node_modules
(~260MB). Miren uploads the context *before* Docker applies .dockerignore, so
every deploy shipped ~750MB. Prune the server image's non-inputs from the temp
context (ios/, node_modules everywhere, .git/.claude, local *.db, the binary):
measured 755MB -> 1.3MB, with go source / Dockerfile / .miren / web/ intact.

Also:
- ios/.gitignore: ignore the build*/ derived-data dirs (build-mac, build-sim, …)
  and *.xcarchive — build output that shouldn't be tracked.
- .dockerignore: exclude node_modules repo-wide — the sibling Node apps (agent,
  devagent) run their own npm install in-image, so host modules are wrong-platform
  bloat that must never be copied in.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Paul Campbell cf58ddb5f7969fa54247c142866c3d68c482b7ac parent dadf01f
3 files changed, +16 −2
  • .dockerignore +3 −0
  • deploy-instance.sh +9 −1
  • ios/.gitignore +4 −1
diff --git a/.dockerignore b/.dockerignore
index 43135e3..06f4e10 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -10,3 +10,6 @@ README.md
# build output) are never part of the server build context.
/ios
.claude
+# Sibling Node apps (agent, devagent) run their own npm install in-image, so host
+# node_modules must never be copied in — wrong platform, and pure bloat.
+**/node_modules
diff --git a/deploy-instance.sh b/deploy-instance.sh
index 5bed176..549381b 100755
--- a/deploy-instance.sh
+++ b/deploy-instance.sh
@@ -21,7 +21,15 @@ trap 'rm -rf "$TMP"' EXIT
# Build context = the source, with instance-specific app name + disk name.
cp -R "$REPO"/. "$TMP"/
-rm -rf "$TMP/.git"
+# Trim the context before Miren uploads it. Docker applies .dockerignore at BUILD
+# time, but Miren uploads this dir FIRST — so a fat working tree makes every
+# deploy slow. Drop what the server image never needs: the native ios/ build
+# output (~700MB), the sibling Node apps' node_modules (~260MB), VCS/editor/agent
+# dirs, the local binary, and *.db (local SQLite holding user data — must never
+# leave the machine). Mirrors .dockerignore, plus node_modules everywhere.
+rm -rf "$TMP/.git" "$TMP/ios" "$TMP/.claude" "$TMP/lchat" \
+ "$TMP"/*.db "$TMP"/*.db-wal "$TMP"/*.db-shm
+find "$TMP" -name node_modules -type d -prune -exec rm -rf {} + 2>/dev/null || true
sed -e "s/^name = \"lchat\"\$/name = \"$INSTANCE\"/" \
-e "s/^name = \"lchat-data\"\$/name = \"${INSTANCE}-data\"/" \
"$REPO/.miren/app.toml" > "$TMP/.miren/app.toml"
diff --git a/ios/.gitignore b/ios/.gitignore
index ec8c35f..dd9b2b2 100644
--- a/ios/.gitignore
+++ b/ios/.gitignore
@@ -1,7 +1,10 @@
# The Xcode project is generated from project.yml by xcodegen.
LChat.xcodeproj/
-build/
+# Build output — `build/` plus the custom -derivedDataPath dirs the build/release
+# recipes use (build-mac, build-sim, …). None of it belongs in git.
+build*/
DerivedData/
+*.xcarchive
# Convenience symlinks into build/ from the README's headless-build recipe.
LChat-*.app
*.xcuserstate