You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- When the container fails to start due to image issues → try `--cached-rebuild-sandbox-image` first, then `--full-rebuild-sandbox-image`
432
432
- When you want a completely fresh environment → use `--full-rebuild-sandbox-image`
433
433
434
+
**Local submodule dev rebuild (no push required):**
435
+
```bash
436
+
# Fast rebuild using local packages/opencode checkout (including uncommitted edits)
437
+
just run start --cached-rebuild-sandbox-image --local-opencode-submodule
438
+
439
+
# Full no-cache rebuild from local packages/opencode checkout
440
+
just run start --full-rebuild-sandbox-image --local-opencode-submodule
441
+
```
442
+
- This mode is for local development/debugging only and bypasses the default remote clone path.
443
+
- `just run status` will show commit metadata derived from your local checkout (dirty trees are marked with `-dirty`).
444
+
- Local context packaging intentionally skips heavyweight/dev metadata folders (for example `.planning`, `.git`, `node_modules`, `target`, and `dist`).
445
+
- Keep CI/release workflows on the default pinned remote mode.
446
+
447
+
### Dockerfile Optimization Checklist
448
+
449
+
For new Docker build steps, follow this checklist:
450
+
- Prefer BuildKit cache mounts (`RUN --mount=type=cache`) for package caches (`apt`, `bun`, `cargo`, `pip`, and `pnpm/npm`).
451
+
- Create and remove temporary workdirs in the same `RUN` layer (for example `/tmp/opencode-repo`).
452
+
- Do not defer cleanup to later layers; deleted files still exist in lower layers.
453
+
- Keep builder-stage artifacts out of runtime layers by copying only final outputs.
454
+
- When adding Docker build assets, update build-context inclusion logic in `packages/core/src/docker/image.rs`.
455
+
- Keep local submodule exclude lists aligned with Dockerfile hygiene rules (`.planning`, `.git`, `node_modules`, `target`, `dist`, and similar dev metadata).
456
+
457
+
This policy is intentional for both image-size hygiene and fast local rebuilds.
458
+
459
+
**Worktree-isolated sandbox profiles (opt-in):**
460
+
```bash
461
+
# Derive a stable instance name from the current git worktree root
462
+
just run --sandbox-instance auto start --cached-rebuild-sandbox-image
463
+
464
+
# Use an explicit instance name
465
+
just run --sandbox-instance mytree start --cached-rebuild-sandbox-image
466
+
```
467
+
- Default behavior (no `--sandbox-instance`) remains the shared legacy sandbox.
468
+
- Isolated instances use separate container names, image tags, Docker volumes, and image-state files.
469
+
- You can also set `OPENCODE_SANDBOX_INSTANCE=<name|auto>` instead of passing the CLI flag every time.
0 commit comments