containerify 2.2.0 → 2.4.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/lib/MIMETypes.d.ts +13 -0
- package/lib/appLayerCreator.d.ts +6 -0
- package/lib/appLayerCreator.js +1 -1
- package/lib/cli.d.ts +2 -0
- package/lib/fileutil.d.ts +7 -0
- package/lib/logger.d.ts +7 -0
- package/lib/registry.d.ts +9 -0
- package/lib/tarExporter.d.ts +6 -0
- package/lib/tarExporter.js +1 -1
- package/lib/types.d.ts +83 -0
- package/lib/utils.d.ts +6 -0
- package/lib/version.d.ts +1 -0
- package/lib/version.js +1 -1
- package/package.json +2 -3
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface MIMETypes {
|
|
2
|
+
index: string;
|
|
3
|
+
manifest: string;
|
|
4
|
+
layer: LayerTypes;
|
|
5
|
+
config: string;
|
|
6
|
+
}
|
|
7
|
+
interface LayerTypes {
|
|
8
|
+
tar: string;
|
|
9
|
+
gzip: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const OCI: MIMETypes;
|
|
12
|
+
export declare const DockerV2: MIMETypes;
|
|
13
|
+
export {};
|
package/lib/appLayerCreator.js
CHANGED
|
@@ -127,7 +127,7 @@ function addDataLayer(tmpdir, todir, options, config, manifest, files, comment)
|
|
|
127
127
|
comment +
|
|
128
128
|
(comment == "dependencies" ? ". Did you forget to run npm install?" : ""));
|
|
129
129
|
}
|
|
130
|
-
yield tar.
|
|
130
|
+
yield tar.create(Object.assign(Object.assign({}, tarDefaultConfig), Object.assign({ statCache: statCache(options.layerOwner), portable: !options.layerOwner, prefix: "/", cwd: buildDir, file: layerFile, gzip: true, noMtime: !options.setTimeStamp }, (options.setTimeStamp ? { mtime: new Date(options.setTimeStamp) } : {}))), filesToTar);
|
|
131
131
|
const fhash = yield calculateHash(layerFile);
|
|
132
132
|
const finalName = path.join(todir, fhash + ".tar.gz");
|
|
133
133
|
yield fse.move(layerFile, finalName);
|
package/lib/cli.d.ts
ADDED
package/lib/logger.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Platform } from "./types";
|
|
2
|
+
export declare function createRegistry(registryBaseUrl: string, token: string): {
|
|
3
|
+
download: (imageStr: string, folder: string, preferredPlatform: Platform, cacheFolder?: string) => Promise<void>;
|
|
4
|
+
upload: (imageStr: string, folder: string) => Promise<void>;
|
|
5
|
+
};
|
|
6
|
+
export declare function createDockerRegistry(auth?: string): {
|
|
7
|
+
download: (imageStr: string, folder: string, platform: Platform, cacheFolder?: string) => Promise<void>;
|
|
8
|
+
upload: (imageStr: string, folder: string) => Promise<void>;
|
|
9
|
+
};
|
package/lib/tarExporter.js
CHANGED
|
@@ -46,7 +46,7 @@ function saveToTar(fromdir, tmpdir, toPath, repoTags, options) {
|
|
|
46
46
|
];
|
|
47
47
|
yield fs_1.promises.writeFile(path.join(tardir, "manifest.json"), JSON.stringify(simpleManifest));
|
|
48
48
|
yield fs_1.promises.writeFile(path.join(tardir, "config.json"), JSON.stringify(config));
|
|
49
|
-
yield tar.
|
|
49
|
+
yield tar.create(Object.assign(Object.assign({}, tarDefaultConfig), Object.assign({ cwd: tardir, file: toPath, noMtime: !options.setTimeStamp }, (options.setTimeStamp ? { mtime: new Date(options.setTimeStamp) } : {}))), ["config.json", "manifest.json"].concat(layers));
|
|
50
50
|
logger_1.default.info("Finished " + toPath);
|
|
51
51
|
});
|
|
52
52
|
}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
type Descriptor = {
|
|
2
|
+
mediaType: string;
|
|
3
|
+
size: number;
|
|
4
|
+
digest: string;
|
|
5
|
+
};
|
|
6
|
+
export type Layer = Descriptor;
|
|
7
|
+
export type Image = {
|
|
8
|
+
path: string;
|
|
9
|
+
tag: string;
|
|
10
|
+
};
|
|
11
|
+
export type Index = {
|
|
12
|
+
mediaType: string;
|
|
13
|
+
schemaVersion: string;
|
|
14
|
+
manifests: Array<IndexManifest>;
|
|
15
|
+
annotations?: Map<string, string>;
|
|
16
|
+
};
|
|
17
|
+
export type IndexManifest = Descriptor & {
|
|
18
|
+
platform: Platform;
|
|
19
|
+
};
|
|
20
|
+
export type Platform = {
|
|
21
|
+
architecture: string;
|
|
22
|
+
os: string;
|
|
23
|
+
};
|
|
24
|
+
export type Manifest = {
|
|
25
|
+
config: Descriptor;
|
|
26
|
+
mediaType: string;
|
|
27
|
+
layers: Array<Layer>;
|
|
28
|
+
};
|
|
29
|
+
export type PartialManifestConfig = Omit<Descriptor, "digest"> & Partial<Pick<Descriptor, "digest">>;
|
|
30
|
+
export type Config = {
|
|
31
|
+
architecture?: string;
|
|
32
|
+
os?: string;
|
|
33
|
+
history: Array<HistoryLine>;
|
|
34
|
+
rootfs: {
|
|
35
|
+
diff_ids: string[];
|
|
36
|
+
};
|
|
37
|
+
config: {
|
|
38
|
+
Labels: Record<string, string>;
|
|
39
|
+
Env: string[];
|
|
40
|
+
WorkingDir: string;
|
|
41
|
+
Entrypoint: string[];
|
|
42
|
+
User: string;
|
|
43
|
+
};
|
|
44
|
+
container_config: {
|
|
45
|
+
Labels: Record<string, string>;
|
|
46
|
+
Env: string[];
|
|
47
|
+
User: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export type HistoryLine = {
|
|
51
|
+
created: string;
|
|
52
|
+
created_by: string;
|
|
53
|
+
empty_layer?: boolean;
|
|
54
|
+
comment?: string;
|
|
55
|
+
};
|
|
56
|
+
export type Options = {
|
|
57
|
+
fromImage: string;
|
|
58
|
+
toImage: string;
|
|
59
|
+
folder: string;
|
|
60
|
+
file?: string;
|
|
61
|
+
fromRegistry?: string;
|
|
62
|
+
fromToken?: string;
|
|
63
|
+
toRegistry?: string;
|
|
64
|
+
toToken?: string;
|
|
65
|
+
toTar?: string;
|
|
66
|
+
registry?: string;
|
|
67
|
+
platform: string;
|
|
68
|
+
token?: string;
|
|
69
|
+
user: string;
|
|
70
|
+
workdir: string;
|
|
71
|
+
entrypoint: string;
|
|
72
|
+
labels: Record<string, string>;
|
|
73
|
+
envs: string[];
|
|
74
|
+
setTimeStamp?: string;
|
|
75
|
+
verbose?: boolean;
|
|
76
|
+
allowInsecureRegistries?: boolean;
|
|
77
|
+
customContent: string[];
|
|
78
|
+
extraContent: Record<string, string>;
|
|
79
|
+
layerOwner?: string;
|
|
80
|
+
buildFolder?: string;
|
|
81
|
+
layerCacheFolder?: string;
|
|
82
|
+
};
|
|
83
|
+
export {};
|
package/lib/utils.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Layer, Manifest, Platform } from "./types";
|
|
2
|
+
export declare function unique(vals: string[]): string[];
|
|
3
|
+
export declare function omit<T>(obj: Record<string, T>, keys: string[]): Record<string, T>;
|
|
4
|
+
export declare function getPreferredPlatform(platform?: string): Platform;
|
|
5
|
+
export declare function getManifestLayerType(manifest: Manifest): string;
|
|
6
|
+
export declare function getLayerTypeFileEnding(layer: Layer): ".tar.gz" | ".tar";
|
package/lib/version.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VERSION = "2.4.0";
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "containerify",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Build node.js docker images without docker",
|
|
5
5
|
"main": "./lib/cli.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,8 +29,7 @@
|
|
|
29
29
|
"url": "https://github.com/eoftedal/containerify.git"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
|
-
"lib
|
|
33
|
-
"bin/*"
|
|
32
|
+
"lib/"
|
|
34
33
|
],
|
|
35
34
|
"keywords": [
|
|
36
35
|
"docker",
|