build-strap 4.0.0-dev.46 → 4.0.0-dev.54

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.
Files changed (107) hide show
  1. package/README.md +3 -34
  2. package/package.json +23 -19
  3. package/src/ant.d.ts +19 -0
  4. package/src/ant.js +12 -36
  5. package/src/cert.d.ts +12 -0
  6. package/src/cert.js +87 -148
  7. package/src/clean.d.ts +4 -0
  8. package/src/clean.js +5 -13
  9. package/src/copy.d.ts +7 -0
  10. package/src/copy.js +48 -74
  11. package/src/cp.d.ts +17 -0
  12. package/src/cp.js +81 -165
  13. package/src/docker.container.d.ts +73 -0
  14. package/src/docker.container.js +208 -350
  15. package/src/docker.d.ts +68 -0
  16. package/src/docker.js +163 -339
  17. package/src/docker.network.d.ts +42 -0
  18. package/src/docker.network.js +67 -141
  19. package/src/docker.volume.d.ts +26 -0
  20. package/src/docker.volume.js +50 -124
  21. package/src/dockerCleanup.d.ts +38 -0
  22. package/src/dockerCleanup.js +62 -136
  23. package/src/dockerCompose.d.ts +154 -0
  24. package/src/dockerCompose.js +390 -716
  25. package/src/fs.d.ts +5 -0
  26. package/src/fs.js +33 -91
  27. package/src/git.d.ts +9 -0
  28. package/src/git.js +19 -29
  29. package/src/index.d.ts +20 -0
  30. package/src/index.js +20 -26
  31. package/src/maps.d.ts +33 -0
  32. package/src/maps.js +12 -82
  33. package/src/npm.d.ts +48 -0
  34. package/src/npm.js +128 -131
  35. package/src/pkg.d.ts +38 -0
  36. package/src/pkg.js +27 -74
  37. package/src/publish.d.ts +27 -0
  38. package/src/publish.js +51 -138
  39. package/src/run.d.ts +13 -0
  40. package/src/run.js +39 -84
  41. package/src/tgz.d.ts +13 -0
  42. package/src/tgz.js +54 -88
  43. package/src/version.d.ts +34 -0
  44. package/src/version.js +85 -126
  45. package/src/yarn.d.ts +44 -0
  46. package/src/yarn.js +147 -115
  47. package/ant.js +0 -43
  48. package/ant.js.flow +0 -42
  49. package/artifactory.js +0 -617
  50. package/artifactory.js.flow +0 -616
  51. package/cert.conf +0 -20
  52. package/cert.js +0 -153
  53. package/cert.js.flow +0 -152
  54. package/clean.js +0 -20
  55. package/clean.js.flow +0 -19
  56. package/copy.js +0 -80
  57. package/copy.js.flow +0 -79
  58. package/cp.js +0 -173
  59. package/cp.js.flow +0 -172
  60. package/docker.container.js +0 -390
  61. package/docker.container.js.flow +0 -389
  62. package/docker.js +0 -365
  63. package/docker.js.flow +0 -364
  64. package/docker.network.js +0 -160
  65. package/docker.network.js.flow +0 -159
  66. package/docker.volume.js +0 -136
  67. package/docker.volume.js.flow +0 -136
  68. package/dockerCleanup.js +0 -152
  69. package/dockerCleanup.js.flow +0 -151
  70. package/dockerCompose.js +0 -766
  71. package/dockerCompose.js.flow +0 -765
  72. package/flow.js +0 -21
  73. package/flow.js.flow +0 -20
  74. package/fs.js +0 -95
  75. package/fs.js.flow +0 -96
  76. package/git.js +0 -35
  77. package/git.js.flow +0 -34
  78. package/hg.js +0 -35
  79. package/hg.js.flow +0 -34
  80. package/index.js +0 -27
  81. package/index.js.flow +0 -26
  82. package/inline-resources.js +0 -158
  83. package/inline-resources.js.flow +0 -157
  84. package/maps.js +0 -112
  85. package/maps.js.flow +0 -111
  86. package/npm.js +0 -145
  87. package/npm.js.flow +0 -144
  88. package/pkg.js +0 -81
  89. package/pkg.js.flow +0 -80
  90. package/publish.js +0 -145
  91. package/publish.js.flow +0 -144
  92. package/run.js +0 -90
  93. package/run.js.flow +0 -89
  94. package/src/artifactory.js +0 -616
  95. package/src/cert.conf +0 -20
  96. package/src/flow.js +0 -20
  97. package/src/hg.js +0 -34
  98. package/src/inline-resources.js +0 -157
  99. package/src/test.js +0 -55
  100. package/test.js +0 -56
  101. package/test.js.flow +0 -55
  102. package/tgz.js +0 -102
  103. package/tgz.js.flow +0 -101
  104. package/version.js +0 -143
  105. package/version.js.flow +0 -142
  106. package/yarn.js +0 -124
  107. package/yarn.js.flow +0 -123
package/src/docker.js CHANGED
@@ -1,66 +1,35 @@
1
- // @flow
2
- import path from 'path';
3
1
  import bytes from 'bytes';
4
2
  import isReachable from 'is-reachable';
5
3
  import moment from 'moment';
6
- import { buildLog } from './run';
7
- import { getCfg, getPkgName, getPkgScope } from './pkg';
8
- import { spawn } from './cp';
9
- import { getVersion, getDevBranch } from './version';
10
- import {
11
- dockerContainerRunDaemon,
12
- dockerContainerKill,
13
- } from './docker.container';
14
- import { dockerNetworkConnect } from './docker.network';
15
-
16
- export type DockerConfig = {
17
- registry?: string,
18
- repository?: string,
19
- name?: string,
20
- };
21
-
22
- export function getDockerConfig(): DockerConfig {
23
- return getCfg().docker || {};
24
- }
25
-
26
- export const parseDockerDate = (date: string): Date =>
27
- moment(date, 'YYYY-MM-DD HH:mm:ss ZZ').toDate();
28
-
29
- export async function dockerBuild(
30
- tags: string[] = ['latest'],
31
- buildArgs: string[] = [],
32
- target: ?string = null,
33
- extraArgs?: ?(string[]) = [],
34
- repo: string = getDockerRepo(),
35
- dockerFile: string = './Dockerfile',
36
- workDir: string = '.',
37
- ): Promise<string> {
38
- const args = [
39
- 'build',
40
- ...['-f', path.resolve(dockerFile)],
41
- ...(target ? ['--target', target] : []),
42
- ...tags.reduce((ar, t) => [...ar, '-t', `${repo}:${t}`], []),
43
- ...buildArgs.reduce((ar, a) => [...ar, '--build-arg', a], []),
44
- ...(extraArgs || []),
45
- path.resolve(workDir),
46
- ];
47
-
48
- return spawn('docker', args, { stdio: 'inherit' });
49
- }
50
-
51
- export async function dockerTag(
52
- imageId: string,
53
- tags: string[] = ['latest'],
54
- repo?: string = getDockerRepo(),
55
- ): Promise<void> {
56
- await Promise.all(
57
- tags.map(async (t) => {
58
- await spawn('docker', ['tag', imageId, `${repo}:${t}`]);
59
- buildLog(`Tagged image ${imageId} as ${repo}:${t}`);
60
- }),
61
- );
4
+ import path from 'path';
5
+ import { spawn } from './cp.js';
6
+ import { dockerContainerKill, dockerContainerRunDaemon, } from './docker.container.js';
7
+ import { dockerNetworkConnect } from './docker.network.js';
8
+ import { getCfg, getPkgName, getPkgScope } from './pkg.js';
9
+ import { buildLog } from './run.js';
10
+ import { getDevBranch, getVersion } from './version.js';
11
+ export function getDockerConfig() {
12
+ return getCfg().docker || {};
13
+ }
14
+ export const parseDockerDate = (date) => moment(date, 'YYYY-MM-DD HH:mm:ss ZZ').toDate();
15
+ export async function dockerBuild(tags = ['latest'], buildArgs = [], target = null, extraArgs = [], repo = getDockerRepo(), dockerFile = './Dockerfile', workDir = '.') {
16
+ const args = [
17
+ 'build',
18
+ ...['-f', path.resolve(dockerFile)],
19
+ ...(target ? ['--target', target] : []),
20
+ ...tags.reduce((ar, t) => [...ar, '-t', `${repo}:${t}`], []),
21
+ ...buildArgs.reduce((ar, a) => [...ar, '--build-arg', a], []),
22
+ ...(extraArgs || []),
23
+ path.resolve(workDir),
24
+ ];
25
+ return (await spawn('docker', args, { stdio: 'inherit' })).output;
26
+ }
27
+ export async function dockerTag(imageId, tags = ['latest'], repo = getDockerRepo()) {
28
+ await Promise.all(tags.map(async (t) => {
29
+ await spawn('docker', ['tag', imageId, `${repo}:${t}`]);
30
+ buildLog(`Tagged image ${imageId} as ${repo}:${t}`);
31
+ }));
62
32
  }
63
-
64
33
  /**
65
34
  * Apply the standard convention for tagging the docker image for the project,
66
35
  * based on the source control branch being built.
@@ -72,293 +41,148 @@ export async function dockerTag(
72
41
  * @param {string} imageId id of the docker image to which to apply the tags
73
42
  * @param {string} repo optional override of the docker repo url to use (derived from package.json by default)
74
43
  */
75
- export async function dockerTagVersion(
76
- imageId: string,
77
- repo?: string = getDockerRepo(),
78
- ) {
79
- const { isRelease, major, minor, patch, branch } = await getVersion();
80
- // determine what tags to apply
81
- if (isRelease) {
82
- await dockerTag(
83
- imageId,
84
- ['latest', `${major}`, `${major}.${minor}`, `${major}.${minor}.${patch}`],
85
- repo,
86
- );
87
- } else if (branch === (await getDevBranch())) {
88
- await dockerTag(imageId, ['latest-dev'], repo);
89
- } else if (branch.match(/^(release|patch)-/)) {
90
- await dockerTag(imageId, ['latest-rc'], repo);
91
- } else if (branch.match(/^feature-/)) {
92
- await dockerTag(imageId, ['latest-feature'], repo);
93
- }
44
+ export async function dockerTagVersion(imageId, repo = getDockerRepo()) {
45
+ const { branch, isRelease, major, minor, patch } = await getVersion();
46
+ // determine what tags to apply
47
+ if (isRelease) {
48
+ await dockerTag(imageId, ['latest', `${major}`, `${major}.${minor}`, `${major}.${minor}.${patch}`], repo);
49
+ }
50
+ else if (branch === (await getDevBranch())) {
51
+ await dockerTag(imageId, ['latest-dev'], repo);
52
+ }
53
+ else if (branch.match(/^(release|patch)-/)) {
54
+ await dockerTag(imageId, ['latest-rc'], repo);
55
+ }
56
+ else if (branch.match(/^feature-/)) {
57
+ await dockerTag(imageId, ['latest-feature'], repo);
58
+ }
94
59
  }
95
-
96
- export type DockerImage = {
97
- repository: string,
98
- tag: string,
99
- id: string,
100
- digest: string,
101
- created: Date,
102
- size: number,
103
- };
104
-
105
- export type DockerImageFilter = (i: DockerImage) => boolean;
106
-
107
- export async function dockerImages(
108
- repo?: ?string = getDockerRepo(),
109
- filter?: ?DockerImageFilter = null,
110
- ): Promise<DockerImage[]> {
111
- return (
112
- await spawn(
113
- 'docker',
114
- ['images', '--format', `{{json .}}`, ...(repo ? [repo] : [])],
115
- { captureOutput: true },
116
- )
117
- )
118
- .split('\n')
119
- .filter((line) => !!line.trim())
120
- .map((l) => {
121
- const {
122
- Repository: repository,
123
- Tag: tag,
124
- ID: id,
125
- Digest: digest,
126
- CreatedAt,
127
- Size,
128
- } = JSON.parse(l.trim());
129
- return {
130
- repository,
131
- tag,
132
- id,
133
- digest,
134
- created: parseDockerDate(CreatedAt),
135
- size: bytes.parse(Size),
136
- };
60
+ export async function dockerImages(repo = getDockerRepo(), filter = null) {
61
+ return (await spawn('docker', ['images', '--format', `{{json .}}`, ...(repo ? [repo] : [])], { captureOutput: true })).output
62
+ .split('\n')
63
+ .filter((line) => !!line.trim())
64
+ .map((l) => {
65
+ const { CreatedAt, Digest: digest, ID: id, Repository: repository, Size, Tag: tag, } = JSON.parse(l.trim());
66
+ return {
67
+ created: parseDockerDate(CreatedAt),
68
+ digest,
69
+ id,
70
+ repository,
71
+ size: bytes.parse(Size),
72
+ tag,
73
+ };
137
74
  })
138
- .filter(
139
- (m) =>
140
- (m && m.id) != null &&
141
- (typeof filter === 'function' ? filter(m) : true),
142
- );
143
- }
144
-
145
- export async function getDockerId(
146
- tag: string = 'latest',
147
- repo?: ?string,
148
- ): Promise<string> {
149
- return (await dockerImages(repo, (m) => m.tag === tag)).map((m) => m.id)[0];
150
- }
151
-
152
- export async function getUntaggedDockerIds(
153
- repo?: ?string,
154
- filter?: ?DockerImageFilter = null,
155
- ): Promise<string[]> {
156
- return (
157
- await dockerImages(
158
- repo,
159
- (m) =>
160
- m.tag === '<none>' && (typeof filter === 'function' ? filter(m) : true),
161
- )
162
- ).map((m) => m.id);
163
- }
164
-
165
- export async function getDockerTags(
166
- id?: ?string,
167
- repo?: ?string,
168
- fullName: boolean = false,
169
- filter?: ?DockerImageFilter = null,
170
- ): Promise<string[]> {
171
- return (
172
- await dockerImages(
173
- repo,
174
- (m) =>
175
- (!id || m.id === id) &&
176
- (typeof filter === 'function' ? filter(m) : true),
177
- )
178
- ).map((m) => (fullName ? `${m.repository}:${m.tag}` : m.tag));
179
- }
180
-
181
- export async function getDockerDigest(
182
- imageId: string,
183
- repo?: string,
184
- ): Promise<string> {
185
- return (await dockerImages(repo, (m) => m.id === imageId)).map(
186
- (m) => m.digest,
187
- )[0];
188
- }
189
-
190
- export async function dockerLogin(
191
- user: string,
192
- password: string,
193
- registry: string,
194
- ): Promise<void> {
195
- const reg = registry || getDockerConfig().registry;
196
- await spawn(
197
- 'docker',
198
- [
199
- 'login',
200
- '-u',
201
- user || process.env.ARTIFACTORY_USER || '',
202
- '-p',
203
- password || process.env.ARTIFACTORY_PASSWORD || '',
204
- ...(reg ? [reg] : []),
205
- ],
206
- { stdio: 'inherit' },
207
- );
208
- }
209
-
210
- export async function dockerPush(
211
- tags?: string[] = ['latest'],
212
- repo?: string = getDockerRepo(),
213
- ) {
214
- // do this sequentially, so you don't push the same image simultaneously
215
- await tags.reduce(async (prev, tag) => {
216
- await prev;
217
- await spawn('docker', ['push', `${repo}:${tag}`], { stdio: 'inherit' });
218
- }, Promise.resolve());
219
- }
220
-
221
- export type DockerPullOptions = {
222
- image: string,
223
- offline?: boolean,
224
- testUrl?: ?string,
225
- };
226
-
227
- export async function dockerPull({
228
- image,
229
- offline = process.argv.includes('--offline'),
230
- testUrl,
231
- }: DockerPullOptions) {
232
- if (offline || !(await isReachable(testUrl || 'https://hub.docker.com'))) {
233
- if (offline === false) {
234
- throw new Error('Offline, cannot docker pull');
75
+ .filter((m) => (m && m.id) != null &&
76
+ (typeof filter === 'function' ? filter(m) : true));
77
+ }
78
+ export async function getDockerId(tag = 'latest', repo = null) {
79
+ return (await dockerImages(repo, (m) => m.tag === tag)).map((m) => m.id)[0];
80
+ }
81
+ export async function getUntaggedDockerIds(repo, filter = null) {
82
+ return (await dockerImages(repo, (m) => m.tag === '<none>' && (typeof filter === 'function' ? filter(m) : true))).map((m) => m.id);
83
+ }
84
+ export async function getDockerTags(id, repo, fullName = false, filter = null) {
85
+ return (await dockerImages(repo, (m) => (!id || m.id === id) &&
86
+ (typeof filter === 'function' ? filter(m) : true))).map((m) => (fullName ? `${m.repository}:${m.tag}` : m.tag));
87
+ }
88
+ export async function getDockerDigest(imageId, repo) {
89
+ return (await dockerImages(repo, (m) => m.id === imageId)).map((m) => m.digest)[0];
90
+ }
91
+ export async function dockerLogin({ password = process.env.DOCKER_PASSWORD, registry = process.env.DOCKER_REGISTRY, user = process.env.DOCKER_PASSWORD, } = {}) {
92
+ const reg = registry || getDockerConfig().registry;
93
+ await spawn('docker', ['login', '-u', user || '', '-p', password || '', ...(reg ? [reg] : [])], { stdio: 'inherit' });
94
+ }
95
+ export async function dockerPush(tags = ['latest'], repo = getDockerRepo()) {
96
+ // do this sequentially, so you don't push the same image simultaneously
97
+ await tags.reduce(async (prev, tag) => {
98
+ await prev;
99
+ await spawn('docker', ['push', `${repo}:${tag}`], { stdio: 'inherit' });
100
+ }, Promise.resolve());
101
+ }
102
+ export async function dockerPull({ image, offline = process.argv.includes('--offline'), testUrl, }) {
103
+ if (offline || !(await isReachable(testUrl || 'https://hub.docker.com'))) {
104
+ if (offline === false) {
105
+ throw new Error('Offline, cannot docker pull');
106
+ }
107
+ buildLog('It looks like you are offline, skipping docker pull');
108
+ }
109
+ else {
110
+ // throws on failure
111
+ await spawn('docker', ['pull', image], { stdio: 'inherit' });
235
112
  }
236
- buildLog('It looks like you are offline, skipping docker pull');
237
- } else {
238
- // throws on failure
239
- await spawn('docker', ['pull', image], { stdio: 'inherit' });
240
- }
241
- }
242
-
243
- export async function dockerRmi(
244
- images: string[] = [],
245
- ignoreErrors: boolean = true,
246
- ): Promise<void> {
247
- // must do these sequentially, or they will interfere with each other
248
- await images.reduce(async (prev, image) => {
249
- await prev;
250
- await spawn('docker', ['rmi', image], { stdio: 'inherit' }).catch((err) => {
251
- if (ignoreErrors) {
252
- buildLog(
253
- `Warning (ignored Error): Failed to rm image(s): ${err.message}`,
254
- );
255
- } else {
256
- throw err;
257
- }
258
- });
259
- }, Promise.resolve());
260
113
  }
261
-
262
- export function getDockerRepo(): string {
263
- const { registry, repository: dkrRepo, name: dkrName } = getDockerConfig();
264
- const repository = dkrRepo || getPkgScope();
265
- const name = dkrName || getPkgName(false);
266
- if (!repository || !name) {
267
- throw new Error(
268
- 'Docker configuration is missing or incomplete in package.json',
269
- );
270
- }
271
- return `${registry ? `${registry}/` : ''}${repository}/${name}`;
114
+ export async function dockerRmi(images = [], ignoreErrors = true) {
115
+ // must do these sequentially, or they will interfere with each other
116
+ await images.reduce(async (prev, image) => {
117
+ await prev;
118
+ await spawn('docker', ['rmi', image], { stdio: 'inherit' }).catch((err) => {
119
+ if (ignoreErrors) {
120
+ buildLog(`Warning (ignored Error): Failed to rm image(s): ${err.message}`);
121
+ }
122
+ else {
123
+ throw err;
124
+ }
125
+ });
126
+ }, Promise.resolve());
127
+ }
128
+ export function getDockerRepo() {
129
+ const { name: dkrName, registry, repository: dkrRepo } = getDockerConfig();
130
+ const repository = dkrRepo || getPkgScope();
131
+ const name = dkrName || getPkgName(false);
132
+ if (!repository || !name) {
133
+ throw new Error('Docker configuration is missing or incomplete in package.json');
134
+ }
135
+ return `${registry ? `${registry}/` : ''}${repository}/${name}`;
272
136
  }
273
-
274
- export type PullAndRunContainerOptions = {
275
- ...DockerPullOptions,
276
- runArgs?: string[],
277
- cmd?: string[],
278
- network?: ?string,
279
- alias?: ?string,
280
- };
281
-
282
- export async function dockerPullAndRunContainer(
283
- image: string,
284
- options: PullAndRunContainerOptions = {},
285
- ): Promise<string> {
286
- const {
287
- runArgs = [],
288
- cmd = [],
289
- network,
290
- alias,
291
- offline = process.argv.includes('--offline'),
292
- testUrl,
293
- } = options;
294
-
295
- try {
296
- await dockerPull({ image, offline, testUrl });
297
- } catch (err) {
298
- buildLog(`docker pull failed (${err.message}), attempting to continue...`);
299
- }
300
- const { id } = await dockerContainerRunDaemon({ image, runArgs, cmd });
301
- if (network) {
302
- await dockerNetworkConnect(network, id, alias);
303
- }
304
- return id;
137
+ export async function dockerPullAndRunContainer(options) {
138
+ const { image, runArgs = [], cmd = [], network, alias, offline = process.argv.includes('--offline'), testUrl, } = options;
139
+ try {
140
+ await dockerPull({ image, offline, testUrl });
141
+ }
142
+ catch (err) {
143
+ buildLog(`docker pull failed (${err.message}), attempting to continue...`);
144
+ }
145
+ const { id } = await dockerContainerRunDaemon({ cmd, image, runArgs });
146
+ if (network) {
147
+ await dockerNetworkConnect(network, id, alias);
148
+ }
149
+ return id;
305
150
  }
306
-
307
- export type CopyFilePathConfig = {
308
- from: string,
309
- to: string,
310
- };
311
-
312
- export type CopyFilesFromDockerImageConfig = {
313
- imageId: string,
314
- filePaths: CopyFilePathConfig[],
315
- ignoreErrors?: ?boolean,
316
- };
317
-
318
- export async function copyFilesFromDockerImage({
319
- imageId,
320
- filePaths,
321
- ignoreErrors,
322
- }: CopyFilesFromDockerImageConfig): Promise<any> {
323
- const container = await dockerContainerRunDaemon({
324
- image: imageId,
325
- runArgs: ['-it', '--rm', '--entrypoint=/bin/bash'],
326
- cmd: ['read', '-p', 'pause'],
327
- });
328
-
329
- buildLog(`Copying Files from Docker Image - imageId (${imageId})`);
330
-
331
- const spawnOptions = {
332
- stdio: 'inherit',
333
- pipeOutput: true,
334
- captureOutput: false,
335
- };
336
- const copyErrors = [];
337
-
338
- try {
339
- filePaths.forEach(async (fp) => {
340
- // Try to copy from the Debug Folder
341
- try {
342
- await spawn(
343
- 'docker',
344
- ['cp', `${container.id}:${fp.from}`, fp.to],
345
- spawnOptions,
346
- );
347
- buildLog(`Copied ${fp.from} => ${fp.to}`);
348
- } catch (error) {
349
- copyErrors.push(error);
350
- buildLog(`Error copying file ${fp.from}`);
351
- }
151
+ export async function copyFilesFromDockerImage({ filePaths, ignoreErrors, imageId, }) {
152
+ const container = await dockerContainerRunDaemon({
153
+ cmd: ['read', '-p', 'pause'],
154
+ image: imageId,
155
+ runArgs: ['-it', '--rm', '--entrypoint=/bin/bash'],
352
156
  });
353
- } finally {
157
+ buildLog(`Copying Files from Docker Image - imageId (${imageId})`);
158
+ const spawnOptions = {
159
+ captureOutput: false,
160
+ pipeOutput: true,
161
+ stdio: 'inherit',
162
+ };
163
+ const copyErrors = [];
354
164
  try {
355
- await dockerContainerKill(container.id);
356
- } catch (error) {
357
- copyErrors.push(error);
165
+ filePaths.forEach(async (fp) => {
166
+ // Try to copy from the Debug Folder
167
+ try {
168
+ await spawn('docker', ['cp', `${container.id}:${fp.from}`, fp.to], spawnOptions);
169
+ buildLog(`Copied ${fp.from} => ${fp.to}`);
170
+ }
171
+ catch (error) {
172
+ copyErrors.push(error);
173
+ buildLog(`Error copying file ${fp.from}`);
174
+ }
175
+ });
176
+ }
177
+ finally {
178
+ try {
179
+ await dockerContainerKill(container.id);
180
+ }
181
+ catch (error) {
182
+ copyErrors.push(error);
183
+ }
184
+ }
185
+ if (copyErrors.length > 0 && ignoreErrors !== true) {
186
+ throw new Error('Some files failed to copy');
358
187
  }
359
- }
360
-
361
- if (copyErrors.length > 0 && ignoreErrors !== true) {
362
- throw new Error('Some files failed to copy');
363
- }
364
188
  }
@@ -0,0 +1,42 @@
1
+ export interface DockerNetwork {
2
+ IPv6: boolean;
3
+ created: Date;
4
+ driver: string;
5
+ exists: () => Promise<boolean>;
6
+ id: string;
7
+ labels: string[];
8
+ name: string;
9
+ rm: () => Promise<void>;
10
+ scope: string;
11
+ }
12
+ interface DockerNetworkLsOptions {
13
+ filter?: (network: DockerNetwork) => boolean;
14
+ }
15
+ export declare function unthrottledDockerNetworkLs({ filter, }?: DockerNetworkLsOptions): Promise<DockerNetwork[]>;
16
+ export declare const dockerNetworkLs: (options?: DockerNetworkLsOptions) => Promise<DockerNetwork[]> | undefined;
17
+ export declare function dockerNetworkFind(networkName: string, options?: DockerNetworkLsOptions): Promise<DockerNetwork | null>;
18
+ export interface DockerNetworkCreateOptions {
19
+ auxAddresses?: string[];
20
+ driver?: string;
21
+ driverOpts?: Record<string, string>;
22
+ gateways?: string[];
23
+ ingress?: boolean;
24
+ internal?: boolean;
25
+ ipRange?: string;
26
+ ipv6?: boolean;
27
+ labels?: string[];
28
+ subnets?: string[];
29
+ }
30
+ export declare function dockerNetworkCreate(networkName: string, { driver, driverOpts, ipRange, gateways, subnets, auxAddresses, ingress, internal, ipv6, labels, }?: DockerNetworkCreateOptions): Promise<DockerNetwork | null>;
31
+ /**
32
+ * Removes a network by id
33
+ * @param {string} id The id of the network
34
+ */
35
+ export declare function dockerNetworkRm(id: string): Promise<void>;
36
+ /**
37
+ * Removes all networks with the given name
38
+ * @param {string} networkName The name of the network
39
+ */
40
+ export declare function dockerNetworkDelete(networkName: string): Promise<void>;
41
+ export declare function dockerNetworkConnect(networkName: string, containerId: string, alias?: string | null): Promise<void>;
42
+ export {};