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.
@@ -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 {};
@@ -0,0 +1,6 @@
1
+ import { Options } from "./types";
2
+ declare function addLayers(tmpdir: string, fromdir: string, todir: string, options: Options): Promise<void>;
3
+ declare const _default: {
4
+ addLayers: typeof addLayers;
5
+ };
6
+ export default _default;
@@ -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.c(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);
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
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,7 @@
1
+ export declare function sizeOf(file: string): Promise<number>;
2
+ export declare function ensureEmptyDir(path: string): Promise<string>;
3
+ declare const _default: {
4
+ sizeOf: typeof sizeOf;
5
+ ensureEmptyDir: typeof ensureEmptyDir;
6
+ };
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const logger: {
2
+ enableDebug: () => boolean;
3
+ info: (...msg: unknown[]) => void;
4
+ error: (...msg: unknown[]) => void;
5
+ debug: (...msg: unknown[]) => void;
6
+ };
7
+ export default logger;
@@ -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
+ };
@@ -0,0 +1,6 @@
1
+ import { Options } from "./types";
2
+ declare function saveToTar(fromdir: string, tmpdir: string, toPath: string, repoTags: string[], options: Options): Promise<void>;
3
+ declare const _default: {
4
+ saveToTar: typeof saveToTar;
5
+ };
6
+ export default _default;
@@ -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.c(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));
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";
@@ -0,0 +1 @@
1
+ export declare const VERSION = "2.4.0";
package/lib/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "2.2.0";
4
+ exports.VERSION = "2.4.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "containerify",
3
- "version": "2.2.0",
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/*.js",
33
- "bin/*"
32
+ "lib/"
34
33
  ],
35
34
  "keywords": [
36
35
  "docker",