feat(tsdocker): add multi-registry and multi-arch Docker build/push/pull manager, registry storage, Dockerfile handling, and new CLI commands

This commit is contained in:
2026-01-20 09:33:31 +00:00
parent e9a12f1c17
commit e1492f8ec4
14 changed files with 1211 additions and 53 deletions

View File

@@ -2,39 +2,108 @@
## Module Purpose
tsdocker is a tool for developing npm modules cross-platform using Docker. It allows testing in clean, reproducible Linux environments locally.
tsdocker is a comprehensive Docker development and building tool. It provides:
- Testing npm modules in clean Docker environments (legacy feature)
- Building Dockerfiles with dependency ordering
- Multi-registry push/pull support
- Multi-architecture builds (amd64/arm64)
## Recent Upgrades (2025-11-22)
## New CLI Commands (2026-01-19)
- Updated all @git.zone/_ dependencies to @git.zone/_ scope (latest versions)
- Updated all @pushrocks/_ dependencies to @push.rocks/_ scope (latest versions)
- Migrated from smartfile v8 to smartfs v1.1.0
- All filesystem operations now use smartfs fluent API
- Operations are now async (smartfs is async-only)
- Updated dev dependencies:
- @git.zone/tsbuild: ^3.1.0
- @git.zone/tsrun: ^2.0.0
- @git.zone/tstest: ^3.1.3
- Removed @pushrocks/tapbundle (now use @git.zone/tstest/tapbundle)
- Updated @types/node to ^22.10.2
- Removed tslint and tslint-config-prettier (no longer needed)
| Command | Description |
|---------|-------------|
| `tsdocker` | Run tests in container (legacy default behavior) |
| `tsdocker build` | Build all Dockerfiles with dependency ordering |
| `tsdocker push [registry]` | Push images to configured registries |
| `tsdocker pull <registry>` | Pull images from registry |
| `tsdocker test` | Run container tests (test scripts) |
| `tsdocker login` | Login to configured registries |
| `tsdocker list` | List discovered Dockerfiles and dependencies |
| `tsdocker clean --all` | Clean up Docker environment |
| `tsdocker vscode` | Start VS Code in Docker |
## SmartFS Migration Details
## Configuration
The following operations were converted:
Configure in `package.json` under `@git.zone/tsdocker`:
- `smartfile.fs.fileExistsSync()` → Node.js `fs.existsSync()` (for sync needs)
- `smartfile.fs.ensureDirSync()` → Node.js `fs.mkdirSync(..., { recursive: true })`
- `smartfile.memory.toFsSync()``smartfs.file(path).write(content)` (async)
- `smartfile.fs.removeSync()``smartfs.file(path).delete()` (async)
```json
{
"@git.zone/tsdocker": {
"registries": ["registry.gitlab.com", "docker.io"],
"registryRepoMap": {
"registry.gitlab.com": "host.today/ht-docker-node"
},
"buildArgEnvMap": {
"NODE_VERSION": "NODE_VERSION"
},
"platforms": ["linux/amd64", "linux/arm64"],
"push": false,
"testDir": "./test"
}
}
```
## Test Status
### Configuration Options
- Build: ✅ Passes
- The integration test requires cloning an external test repository (sandbox-npmts)
- The external test repo uses top-level await which requires ESM module handling
- This is not a tsdocker issue but rather the test repository's structure
- `baseImage`: Base Docker image for testing (legacy)
- `command`: Command to run in container (legacy)
- `dockerSock`: Mount Docker socket (legacy)
- `registries`: Array of registry URLs to push to
- `registryRepoMap`: Map registry URLs to different repo paths
- `buildArgEnvMap`: Map Docker build ARGs to environment variables
- `platforms`: Target architectures for buildx
- `push`: Auto-push after build
- `testDir`: Directory containing test scripts
## Registry Authentication
Set environment variables for registry login:
```bash
# Pipe-delimited format (numbered 1-10)
export DOCKER_REGISTRY_1="registry.gitlab.com|username|password"
export DOCKER_REGISTRY_2="docker.io|username|password"
# Or individual registry format
export DOCKER_REGISTRY_URL="registry.gitlab.com"
export DOCKER_REGISTRY_USER="username"
export DOCKER_REGISTRY_PASSWORD="password"
```
## File Structure
```
ts/
├── index.ts (entry point)
├── tsdocker.cli.ts (CLI commands)
├── tsdocker.config.ts (configuration)
├── tsdocker.plugins.ts (plugin imports)
├── tsdocker.docker.ts (legacy test runner)
├── tsdocker.snippets.ts (Dockerfile generation)
├── classes.dockerfile.ts (Dockerfile management)
├── classes.dockerregistry.ts (registry authentication)
├── classes.registrystorage.ts (registry storage)
├── classes.tsdockermanager.ts (orchestrator)
└── interfaces/
└── index.ts (type definitions)
```
## Dependencies
All dependencies are now at their latest versions compatible with Node.js without introducing new Node.js-specific dependencies.
- `@push.rocks/lik`: Object mapping utilities
- `@push.rocks/smartfs`: Filesystem operations
- `@push.rocks/smartshell`: Shell command execution
- `@push.rocks/smartcli`: CLI framework
- `@push.rocks/projectinfo`: Project metadata
## Build Status
- Build: ✅ Passes
- Legacy test functionality preserved
- New Docker build functionality added
## Previous Upgrades (2025-11-22)
- Updated all @git.zone/_ dependencies to @git.zone/_ scope
- Updated all @pushrocks/_ dependencies to @push.rocks/_ scope
- Migrated from smartfile v8 to smartfs v1.1.0