@magda/docker-utils 2.3.3 → 3.0.0-alpha.1
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/dist/create-docker-context-for-node-component.js +15559 -0
- package/dist/docker-util.js +32 -0
- package/dist/retag-and-push.js +7543 -0
- package/package.json +17 -9
- package/bin/create-docker-context-for-node-component.js +0 -446
- package/bin/docker-util.js +0 -37
- package/bin/retag-and-push.js +0 -122
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// ../../scripts/docker-util.js
|
|
2
|
+
function getVersions(local, version) {
|
|
3
|
+
return version || [
|
|
4
|
+
!local && process.env.npm_package_version ? process.env.npm_package_version : "latest"
|
|
5
|
+
];
|
|
6
|
+
}
|
|
7
|
+
function getName(name) {
|
|
8
|
+
if (name && typeof name === "string") {
|
|
9
|
+
return name;
|
|
10
|
+
}
|
|
11
|
+
return process.env.npm_package_config_docker_name ? process.env.npm_package_config_docker_name : process.env.npm_package_name ? "data61/magda-" + process.env.npm_package_name.split("/")[1] : "UnnamedImage";
|
|
12
|
+
}
|
|
13
|
+
function getTags(tag, local, repository, version, name) {
|
|
14
|
+
if (tag === "auto") {
|
|
15
|
+
return getVersions(local, version).map((version2) => {
|
|
16
|
+
const tagPrefix = getRepository(local, repository);
|
|
17
|
+
const imageName = getName(name);
|
|
18
|
+
return tagPrefix + imageName + ":" + version2;
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
return tag ? [tag] : [];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function getRepository(local, repository) {
|
|
25
|
+
return repository && repository + "/" || (local ? "localhost:5000/" : "");
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
getName,
|
|
29
|
+
getRepository,
|
|
30
|
+
getTags,
|
|
31
|
+
getVersions
|
|
32
|
+
};
|