containerify 3.1.2 → 3.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/lib/appLayerCreator.js +5 -5
- package/lib/cli.js +1 -0
- package/lib/registry.js +2 -1
- package/lib/types.d.ts +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +3 -3
package/lib/appLayerCreator.js
CHANGED
|
@@ -75,8 +75,8 @@ function calculateHash(path) {
|
|
|
75
75
|
stream.on("end", () => resolve(hash.digest("hex")));
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
function copySync(src, dest) {
|
|
79
|
-
const copyOptions = { overwrite: true, dereference: true };
|
|
78
|
+
function copySync(src, dest, preserveTimestamps) {
|
|
79
|
+
const copyOptions = { overwrite: true, dereference: true, preserveTimestamps: preserveTimestamps };
|
|
80
80
|
const destFolder = dest.substring(0, dest.lastIndexOf("/"));
|
|
81
81
|
logger_1.default.debug("Copying " + src + " to " + dest);
|
|
82
82
|
fse.ensureDirSync(destFolder);
|
|
@@ -112,10 +112,10 @@ function addDataLayer(tmpdir, todir, options, config, manifest, files, comment)
|
|
|
112
112
|
const buildDir = yield fileutil.ensureEmptyDir(path.join(tmpdir, "build"));
|
|
113
113
|
files.map((f) => {
|
|
114
114
|
if (Array.isArray(f)) {
|
|
115
|
-
copySync(path.join(options.folder, f[0]), path.join(buildDir, f[1]));
|
|
115
|
+
copySync(path.join(options.folder, f[0]), path.join(buildDir, f[1]), !!options.preserveTimeStamp);
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
118
|
-
copySync(path.join(options.folder, f), path.join(buildDir, options.workdir, f));
|
|
118
|
+
copySync(path.join(options.folder, f), path.join(buildDir, options.workdir, f), !!options.preserveTimeStamp);
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
const layerFile = path.join(todir, "layer.tar.gz");
|
|
@@ -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.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);
|
|
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.preserveTimeStamp) }, (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.js
CHANGED
|
@@ -50,6 +50,7 @@ const possibleArgs = {
|
|
|
50
50
|
"--label <label>": "Optional: Single label (name=value). This option can be used multiple times.",
|
|
51
51
|
"--envs <envs>": "Optional: Comma-separated list of key value pairs to use av environment variables.",
|
|
52
52
|
"--env <env>": "Optional: Single environment variable (name=value). This option can be used multiple times.",
|
|
53
|
+
"--preserveTimeStamp": "Optional: Preserve timestamps on files in the added layers. This might help with cache invalidation.",
|
|
53
54
|
"--setTimeStamp <timestamp>": "Optional: Set a specific ISO 8601 timestamp on all entries (e.g. git commit hash). Default: 1970 in tar files, and current time on manifest/config",
|
|
54
55
|
"--verbose": "Verbose logging",
|
|
55
56
|
"--allowInsecureRegistries": "Allow insecure registries (with self-signed/untrusted cert)",
|
package/lib/registry.js
CHANGED
|
@@ -140,7 +140,8 @@ function processToken(registryBaseUrl, allowInsecure, imagePath, token) {
|
|
|
140
140
|
return getGitLabToken(token, image.path, allowInsecure);
|
|
141
141
|
if (token.startsWith("Basic "))
|
|
142
142
|
return token;
|
|
143
|
-
|
|
143
|
+
const githubPrefixes = ["ghp_", "github_pat_", "gho_", "ghu_", "ghs_"];
|
|
144
|
+
if (githubPrefixes.some((prefix) => token.startsWith(prefix)))
|
|
144
145
|
return "Bearer " + Buffer.from(token).toString("base64");
|
|
145
146
|
return "Bearer " + token;
|
|
146
147
|
});
|
package/lib/types.d.ts
CHANGED
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.
|
|
1
|
+
export declare const VERSION = "3.2.0";
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "containerify",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Build node.js docker images without docker",
|
|
5
5
|
"main": "./lib/cli.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"allTests": "npm run integrationTest && npm run registryTest"
|
|
17
17
|
},
|
|
18
18
|
"bin": {
|
|
19
|
-
"containerify": "
|
|
19
|
+
"containerify": "lib/cli.js"
|
|
20
20
|
},
|
|
21
21
|
"author": "Erlend Oftedal <erlend@oftedal.no>",
|
|
22
22
|
"contributors": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
|
-
"url": "https://github.com/eoftedal/containerify.git"
|
|
28
|
+
"url": "git+https://github.com/eoftedal/containerify.git"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
31
|
"lib/"
|