@git.zone/tsdocker 2.0.2 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.dockerfile.d.ts +4 -0
- package/dist_ts/classes.dockerfile.js +12 -4
- package/dist_ts/classes.globalconfig.d.ts +13 -0
- package/dist_ts/classes.globalconfig.js +66 -0
- package/dist_ts/classes.sshtunnel.d.ts +23 -0
- package/dist_ts/classes.sshtunnel.js +66 -0
- package/dist_ts/classes.tsdockermanager.d.ts +22 -1
- package/dist_ts/classes.tsdockermanager.js +83 -10
- package/dist_ts/classes.tsdockersession.d.ts +3 -2
- package/dist_ts/classes.tsdockersession.js +8 -5
- package/dist_ts/interfaces/index.d.ts +16 -0
- package/dist_ts/tsdocker.cli.js +88 -1
- package/package.json +8 -8
- package/readme.md +64 -0
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.dockerfile.ts +13 -5
- package/ts/classes.globalconfig.ts +76 -0
- package/ts/classes.sshtunnel.ts +77 -0
- package/ts/classes.tsdockermanager.ts +106 -9
- package/ts/classes.tsdockersession.ts +8 -4
- package/ts/interfaces/index.ts +18 -0
- package/ts/tsdocker.cli.ts +93 -0
package/ts/tsdocker.cli.ts
CHANGED
|
@@ -7,6 +7,7 @@ import * as ConfigModule from './tsdocker.config.js';
|
|
|
7
7
|
import { logger, ora } from './tsdocker.logging.js';
|
|
8
8
|
import { TsDockerManager } from './classes.tsdockermanager.js';
|
|
9
9
|
import { DockerContext } from './classes.dockercontext.js';
|
|
10
|
+
import { GlobalConfig } from './classes.globalconfig.js';
|
|
10
11
|
import type { IBuildCommandOptions } from './interfaces/index.js';
|
|
11
12
|
import { commitinfo } from './00_commitinfo_data.js';
|
|
12
13
|
|
|
@@ -33,12 +34,14 @@ COMMANDS
|
|
|
33
34
|
test [flags] Build and run container test scripts
|
|
34
35
|
login Authenticate with configured registries
|
|
35
36
|
list List discovered Dockerfiles
|
|
37
|
+
config <subcommand> [flags] Manage global tsdocker configuration
|
|
36
38
|
clean [-y] [--all] Interactive Docker resource cleanup
|
|
37
39
|
|
|
38
40
|
BUILD / PUSH OPTIONS
|
|
39
41
|
--platform=<p> Target platform (e.g. linux/arm64)
|
|
40
42
|
--timeout=<s> Build timeout in seconds
|
|
41
43
|
--no-cache Rebuild without Docker layer cache
|
|
44
|
+
--no-pull Skip pulling latest base images (use cached)
|
|
42
45
|
--cached Skip builds when Dockerfile is unchanged
|
|
43
46
|
--verbose Stream raw docker build output
|
|
44
47
|
--parallel[=<n>] Parallel builds (optional concurrency limit)
|
|
@@ -52,6 +55,17 @@ CLEAN OPTIONS
|
|
|
52
55
|
-y Auto-confirm all prompts
|
|
53
56
|
--all Include all images and volumes (not just dangling)
|
|
54
57
|
|
|
58
|
+
CONFIG SUBCOMMANDS
|
|
59
|
+
add-builder Add a remote builder node
|
|
60
|
+
--name=<n> Builder name (e.g. arm64-builder)
|
|
61
|
+
--host=<h> SSH host (e.g. user@192.168.1.100)
|
|
62
|
+
--platform=<p> Platform (e.g. linux/arm64)
|
|
63
|
+
--ssh-key=<path> SSH key path (optional)
|
|
64
|
+
remove-builder Remove a remote builder by name
|
|
65
|
+
--name=<n> Builder name to remove
|
|
66
|
+
list-builders List all configured remote builders
|
|
67
|
+
show Show full global config
|
|
68
|
+
|
|
55
69
|
CONFIGURATION
|
|
56
70
|
Configure via npmextra.json under the "@git.zone/tsdocker" key:
|
|
57
71
|
|
|
@@ -62,12 +76,17 @@ CONFIGURATION
|
|
|
62
76
|
push Boolean, auto-push after build
|
|
63
77
|
testDir Directory containing test_*.sh scripts
|
|
64
78
|
|
|
79
|
+
Global config is stored at ~/.git.zone/tsdocker/config.json
|
|
80
|
+
and managed via the "config" command.
|
|
81
|
+
|
|
65
82
|
EXAMPLES
|
|
66
83
|
tsdocker build
|
|
67
84
|
tsdocker build Dockerfile_app --platform=linux/arm64
|
|
68
85
|
tsdocker push --registry=ghcr.io
|
|
69
86
|
tsdocker test --verbose
|
|
70
87
|
tsdocker clean -y --all
|
|
88
|
+
tsdocker config add-builder --name=arm64 --host=user@host --platform=linux/arm64
|
|
89
|
+
tsdocker config list-builders
|
|
71
90
|
`;
|
|
72
91
|
console.log(manPage);
|
|
73
92
|
};
|
|
@@ -102,6 +121,8 @@ export let run = () => {
|
|
|
102
121
|
if (argvArg.cache === false) {
|
|
103
122
|
buildOptions.noCache = true;
|
|
104
123
|
}
|
|
124
|
+
// --pull is default true; --no-pull sets pull=false
|
|
125
|
+
buildOptions.pull = argvArg.pull !== false;
|
|
105
126
|
if (argvArg.cached) {
|
|
106
127
|
buildOptions.cached = true;
|
|
107
128
|
}
|
|
@@ -152,6 +173,7 @@ export let run = () => {
|
|
|
152
173
|
if (argvArg.cache === false) {
|
|
153
174
|
buildOptions.noCache = true;
|
|
154
175
|
}
|
|
176
|
+
buildOptions.pull = argvArg.pull !== false;
|
|
155
177
|
if (argvArg.verbose) {
|
|
156
178
|
buildOptions.verbose = true;
|
|
157
179
|
}
|
|
@@ -225,6 +247,7 @@ export let run = () => {
|
|
|
225
247
|
if (argvArg.cache === false) {
|
|
226
248
|
buildOptions.noCache = true;
|
|
227
249
|
}
|
|
250
|
+
buildOptions.pull = argvArg.pull !== false;
|
|
228
251
|
if (argvArg.cached) {
|
|
229
252
|
buildOptions.cached = true;
|
|
230
253
|
}
|
|
@@ -280,6 +303,76 @@ export let run = () => {
|
|
|
280
303
|
}
|
|
281
304
|
});
|
|
282
305
|
|
|
306
|
+
/**
|
|
307
|
+
* Manage global tsdocker configuration (remote builders, etc.)
|
|
308
|
+
* Usage: tsdocker config <subcommand> [--name=...] [--host=...] [--platform=...] [--ssh-key=...]
|
|
309
|
+
*/
|
|
310
|
+
tsdockerCli.addCommand('config').subscribe(async argvArg => {
|
|
311
|
+
try {
|
|
312
|
+
const subcommand = argvArg._[1] as string;
|
|
313
|
+
|
|
314
|
+
switch (subcommand) {
|
|
315
|
+
case 'add-builder': {
|
|
316
|
+
const name = argvArg.name as string;
|
|
317
|
+
const host = argvArg.host as string;
|
|
318
|
+
const platform = argvArg.platform as string;
|
|
319
|
+
const sshKeyPath = argvArg['ssh-key'] as string | undefined;
|
|
320
|
+
|
|
321
|
+
if (!name || !host || !platform) {
|
|
322
|
+
logger.log('error', 'Required: --name, --host, --platform');
|
|
323
|
+
logger.log('info', 'Usage: tsdocker config add-builder --name=arm64-builder --host=user@host --platform=linux/arm64 [--ssh-key=~/.ssh/id_ed25519]');
|
|
324
|
+
process.exit(1);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
GlobalConfig.addBuilder({ name, host, platform, sshKeyPath });
|
|
328
|
+
logger.log('success', `Remote builder "${name}" configured: ${platform} via ssh://${host}`);
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
case 'remove-builder': {
|
|
333
|
+
const name = argvArg.name as string;
|
|
334
|
+
if (!name) {
|
|
335
|
+
logger.log('error', 'Required: --name');
|
|
336
|
+
logger.log('info', 'Usage: tsdocker config remove-builder --name=arm64-builder');
|
|
337
|
+
process.exit(1);
|
|
338
|
+
}
|
|
339
|
+
GlobalConfig.removeBuilder(name);
|
|
340
|
+
logger.log('success', `Remote builder "${name}" removed`);
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
case 'list-builders': {
|
|
345
|
+
const builders = GlobalConfig.getBuilders();
|
|
346
|
+
if (builders.length === 0) {
|
|
347
|
+
logger.log('info', 'No remote builders configured');
|
|
348
|
+
} else {
|
|
349
|
+
logger.log('info', `${builders.length} remote builder(s):`);
|
|
350
|
+
for (const b of builders) {
|
|
351
|
+
const keyInfo = b.sshKeyPath ? ` (key: ${b.sshKeyPath})` : '';
|
|
352
|
+
logger.log('info', ` ${b.name}: ${b.platform} via ssh://${b.host}${keyInfo}`);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
case 'show': {
|
|
359
|
+
const config = GlobalConfig.load();
|
|
360
|
+
logger.log('info', `Config file: ${GlobalConfig.getConfigPath()}`);
|
|
361
|
+
console.log(JSON.stringify(config, null, 2));
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
default:
|
|
366
|
+
logger.log('error', `Unknown config subcommand: ${subcommand || '(none)'}`);
|
|
367
|
+
logger.log('info', 'Available: add-builder, remove-builder, list-builders, show');
|
|
368
|
+
process.exit(1);
|
|
369
|
+
}
|
|
370
|
+
} catch (err) {
|
|
371
|
+
logger.log('error', `Config failed: ${(err as Error).message}`);
|
|
372
|
+
process.exit(1);
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
|
|
283
376
|
tsdockerCli.addCommand('clean').subscribe(async argvArg => {
|
|
284
377
|
try {
|
|
285
378
|
const autoYes = !!argvArg.y;
|