feat(cli): add global remote builder configuration and native SSH buildx nodes for multi-platform builds
This commit is contained in:
64
readme.md
64
readme.md
@@ -93,6 +93,7 @@ tsdocker push --no-build Dockerfile_api Dockerfile_web
|
||||
| `tsdocker test` | Build + run container test scripts (`test_*.sh`) |
|
||||
| `tsdocker login` | Authenticate with configured registries |
|
||||
| `tsdocker list` | Display discovered Dockerfiles and their dependencies |
|
||||
| `tsdocker config` | Manage global tsdocker configuration (remote builders, etc.) |
|
||||
| `tsdocker clean` | Interactively clean Docker environment |
|
||||
|
||||
### Build Flags
|
||||
@@ -117,6 +118,24 @@ tsdocker push --no-build Dockerfile_api Dockerfile_web
|
||||
| `--registry=<url>` | Push to a single specific registry instead of all configured |
|
||||
| `--no-build` | Skip the build phase; only push existing images from local registry |
|
||||
|
||||
### Config Subcommands
|
||||
|
||||
| Subcommand | Description |
|
||||
|------------|-------------|
|
||||
| `add-builder` | Add or update a remote builder node |
|
||||
| `remove-builder` | Remove a remote builder by name |
|
||||
| `list-builders` | List all configured remote builders |
|
||||
| `show` | Show the full global configuration |
|
||||
|
||||
**`add-builder` flags:**
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `--name=<name>` | Builder name (e.g. `arm64-builder`) |
|
||||
| `--host=<user@ip>` | SSH host (e.g. `armbuilder@192.168.1.100`) |
|
||||
| `--platform=<p>` | Target platform (e.g. `linux/arm64`) |
|
||||
| `--ssh-key=<path>` | SSH key path (optional, uses SSH agent/config by default) |
|
||||
|
||||
### Clean Flags
|
||||
|
||||
| Flag | Description |
|
||||
@@ -294,6 +313,51 @@ tsdocker automatically:
|
||||
- Pushes multi-platform images to the local registry via `buildx --push`
|
||||
- Copies the full manifest list (including all platform variants) to remote registries on `tsdocker push`
|
||||
|
||||
### 🖥️ Native Remote Builders
|
||||
|
||||
Instead of relying on slow QEMU emulation for cross-platform builds, tsdocker can use **native remote machines** via SSH as build nodes. For example, use a real arm64 machine for `linux/arm64` builds:
|
||||
|
||||
```bash
|
||||
# Add a remote arm64 builder
|
||||
tsdocker config add-builder \
|
||||
--name=arm64-builder \
|
||||
--host=armbuilder@192.168.1.100 \
|
||||
--platform=linux/arm64 \
|
||||
--ssh-key=~/.ssh/id_ed25519
|
||||
|
||||
# List configured builders
|
||||
tsdocker config list-builders
|
||||
|
||||
# Remove a builder
|
||||
tsdocker config remove-builder --name=arm64-builder
|
||||
|
||||
# Show full global config
|
||||
tsdocker config show
|
||||
```
|
||||
|
||||
Global configuration is stored at `~/.git.zone/tsdocker/config.json`.
|
||||
|
||||
**How it works:**
|
||||
|
||||
When remote builders are configured and the project's `platforms` includes a matching platform, tsdocker automatically:
|
||||
|
||||
1. Creates a **multi-node buildx builder** — local node for `linux/amd64`, remote SSH node for `linux/arm64`
|
||||
2. Opens **SSH reverse tunnels** so the remote builder can push to the local staging registry
|
||||
3. Builds natively on each platform's hardware — no QEMU overhead
|
||||
4. Tears down tunnels after the build completes
|
||||
|
||||
```
|
||||
[Local machine] [Remote arm64 machine]
|
||||
registry:2 on localhost:PORT <──── SSH reverse tunnel ──── localhost:PORT
|
||||
BuildKit (amd64) ──push──> BuildKit (arm64) ──push──>
|
||||
localhost:PORT localhost:PORT (tunneled)
|
||||
```
|
||||
|
||||
**Prerequisites for the remote machine:**
|
||||
- Docker installed and running
|
||||
- A user with Docker group access (no sudo needed)
|
||||
- SSH key access configured
|
||||
|
||||
### ⚡ Parallel Builds
|
||||
|
||||
Speed up builds by building independent images concurrently:
|
||||
|
||||
Reference in New Issue
Block a user