@vercel/container 0.0.2 → 0.0.3
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/index.js +5 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -83,6 +83,10 @@ function toTag(value) {
|
|
|
83
83
|
function readString(value) {
|
|
84
84
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
85
85
|
}
|
|
86
|
+
function isDockerfileRef(ref) {
|
|
87
|
+
const base = (0, import_node_path.basename)(ref).toLowerCase();
|
|
88
|
+
return base === "dockerfile" || base === "containerfile" || base === "dockerfile.vercel" || base === "containerfile.vercel";
|
|
89
|
+
}
|
|
86
90
|
function run(cmd, args, opts = {}) {
|
|
87
91
|
return new Promise((resolve, reject) => {
|
|
88
92
|
const child = (0, import_node_child_process.spawn)(cmd, args, {
|
|
@@ -1147,10 +1151,6 @@ function devImageTag(serviceName) {
|
|
|
1147
1151
|
const safe = serviceName.toLowerCase().replace(/[^a-z0-9-_.]/g, "-");
|
|
1148
1152
|
return `vercel-dev/${safe || "service"}:dev`;
|
|
1149
1153
|
}
|
|
1150
|
-
function isDockerfileRef(ref) {
|
|
1151
|
-
const base = import_node_path4.default.basename(ref).toLowerCase();
|
|
1152
|
-
return base === "dockerfile" || base === "containerfile" || base.endsWith(".dockerfile");
|
|
1153
|
-
}
|
|
1154
1154
|
function normalizeCommand(command) {
|
|
1155
1155
|
if (typeof command === "string") {
|
|
1156
1156
|
return [command];
|
|
@@ -1400,12 +1400,6 @@ function normalizeCommand2(command) {
|
|
|
1400
1400
|
}
|
|
1401
1401
|
return void 0;
|
|
1402
1402
|
}
|
|
1403
|
-
function isDockerfileRef2(ref) {
|
|
1404
|
-
const base = import_node_path6.default.basename(ref).toLowerCase();
|
|
1405
|
-
return base === "dockerfile" || base === "containerfile" || base.endsWith(".dockerfile") || // Vercel-specific container opt-in markers, used to deploy a project as a
|
|
1406
|
-
// container even when another framework (e.g. Next.js) is also present.
|
|
1407
|
-
base === "dockerfile.vercel" || base === "containerfile.vercel";
|
|
1408
|
-
}
|
|
1409
1403
|
var DOCKERFILE_CANDIDATES = ["Dockerfile.vercel", "Containerfile.vercel"];
|
|
1410
1404
|
function findDockerfile(workPath) {
|
|
1411
1405
|
return DOCKERFILE_CANDIDATES.find(
|
|
@@ -1575,7 +1569,7 @@ async function buildAndPushImage(params) {
|
|
|
1575
1569
|
async function resolveImageHandler(options, span) {
|
|
1576
1570
|
const { config, workPath, entrypoint, meta } = options;
|
|
1577
1571
|
const entrypointRef = readString(entrypoint);
|
|
1578
|
-
const dockerfileConfigured = entrypointRef &&
|
|
1572
|
+
const dockerfileConfigured = entrypointRef && isDockerfileRef(entrypointRef) ? entrypointRef : findDockerfile(workPath);
|
|
1579
1573
|
const dockerfileRel = dockerfileConfigured ?? "Dockerfile";
|
|
1580
1574
|
const dockerfilePath = import_node_path6.default.join(workPath, dockerfileRel);
|
|
1581
1575
|
const hasDockerfile = dockerfileConfigured !== void 0 || (0, import_node_fs6.existsSync)(dockerfilePath);
|