npm-pkgbuild 11.1.11 → 11.1.13
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/README.md +5 -0
- package/package.json +1 -1
- package/src/output/docker.mjs +38 -6
package/README.md
CHANGED
|
@@ -116,6 +116,7 @@ see [mf-hosting](https://www.npmjs.com/package/mf-hosting) or [mf-hosting-fronte
|
|
|
116
116
|
* [fields](#fields)
|
|
117
117
|
* [fields](#fields-1)
|
|
118
118
|
* [fields](#fields-2)
|
|
119
|
+
* [fields](#fields-3)
|
|
119
120
|
* [hookMapping](#hookmapping)
|
|
120
121
|
* [hookMapping](#hookmapping-1)
|
|
121
122
|
* [Field](#field)
|
|
@@ -272,6 +273,10 @@ well known package properties
|
|
|
272
273
|
|
|
273
274
|
## fields
|
|
274
275
|
|
|
276
|
+
* **See**: {<https://docs.docker.com/engine/reference/builder/}>
|
|
277
|
+
|
|
278
|
+
## fields
|
|
279
|
+
|
|
275
280
|
* **See**: <https://rpm-packaging-guide.github.io>
|
|
276
281
|
|
|
277
282
|
## hookMapping
|
package/package.json
CHANGED
package/src/output/docker.mjs
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
2
3
|
import { execa } from "execa";
|
|
3
4
|
import { EmptyContentEntry, ReadableStreamContentEntry } from "content-entry";
|
|
5
|
+
import { transform } from "content-entry-transform";
|
|
6
|
+
import { aggregateFifo } from "aggregate-async-iterator";
|
|
4
7
|
import {
|
|
5
8
|
keyValueTransformer,
|
|
9
|
+
equalSeparatedKeyValuePairOptions
|
|
6
10
|
} from "key-value-transformer";
|
|
7
11
|
import { Packager } from "./packager.mjs";
|
|
12
|
+
import { fieldProvider, copyEntries, utf8StreamOptions } from "../util.mjs";
|
|
8
13
|
|
|
9
14
|
const DOCKERFILE = "Dockerfile";
|
|
10
15
|
|
|
@@ -13,9 +18,8 @@ export class DOCKER extends Packager {
|
|
|
13
18
|
return "docker";
|
|
14
19
|
}
|
|
15
20
|
|
|
16
|
-
static get description()
|
|
17
|
-
|
|
18
|
-
return "generate container image with docker|podman";
|
|
21
|
+
static get description() {
|
|
22
|
+
return "generate container image with docker|podman";
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
async execute(
|
|
@@ -29,6 +33,13 @@ export class DOCKER extends Packager {
|
|
|
29
33
|
options
|
|
30
34
|
);
|
|
31
35
|
|
|
36
|
+
async function* trailingLines() {
|
|
37
|
+
yield `
|
|
38
|
+
FROM node-18
|
|
39
|
+
ENTRYPOINT ["node", ""]
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
|
|
32
43
|
const fp = fieldProvider(properties, fields);
|
|
33
44
|
|
|
34
45
|
transformer.push({
|
|
@@ -36,14 +47,31 @@ export class DOCKER extends Packager {
|
|
|
36
47
|
match: entry => entry.name === DOCKERFILE,
|
|
37
48
|
transform: async entry =>
|
|
38
49
|
new ReadableStreamContentEntry(
|
|
39
|
-
|
|
40
|
-
keyValueTransformer(await entry.readStream, fp
|
|
50
|
+
entry.name,
|
|
51
|
+
keyValueTransformer(await entry.readStream, fp, {
|
|
52
|
+
...equalSeparatedKeyValuePairOptions,
|
|
53
|
+
trailingLines
|
|
54
|
+
})
|
|
41
55
|
),
|
|
42
56
|
createEntryWhenMissing: () => new EmptyContentEntry(DOCKERFILE)
|
|
43
57
|
});
|
|
44
58
|
|
|
59
|
+
for await (const file of copyEntries(
|
|
60
|
+
transform(aggregateFifo(sources), transformer),
|
|
61
|
+
staging,
|
|
62
|
+
expander
|
|
63
|
+
)) {
|
|
64
|
+
if (options.verbose) {
|
|
65
|
+
console.log("D", file.destination);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (options.verbose) {
|
|
70
|
+
console.log(await readFile(join(staging, DOCKERFILE), utf8StreamOptions));
|
|
71
|
+
}
|
|
72
|
+
|
|
45
73
|
if (!options.dry) {
|
|
46
|
-
const docker = await execa("docker", ["build",
|
|
74
|
+
const docker = await execa("docker", ["build", staging], {
|
|
47
75
|
cwd: staging
|
|
48
76
|
});
|
|
49
77
|
|
|
@@ -56,5 +84,9 @@ export class DOCKER extends Packager {
|
|
|
56
84
|
}
|
|
57
85
|
}
|
|
58
86
|
|
|
87
|
+
/**
|
|
88
|
+
* @see {https://docs.docker.com/engine/reference/builder/}
|
|
89
|
+
*/
|
|
59
90
|
const fields = {
|
|
91
|
+
version: { type: "string", mandatory: true }
|
|
60
92
|
};
|