@vercel/container 0.0.1 → 0.0.2
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 +19 -11
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -36,7 +36,6 @@ __export(src_exports, {
|
|
|
36
36
|
version: () => version
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(src_exports);
|
|
39
|
-
var import_build_utils3 = require("@vercel/build-utils");
|
|
40
39
|
var import_node_fs6 = require("fs");
|
|
41
40
|
var import_node_path6 = __toESM(require("path"));
|
|
42
41
|
|
|
@@ -1403,7 +1402,15 @@ function normalizeCommand2(command) {
|
|
|
1403
1402
|
}
|
|
1404
1403
|
function isDockerfileRef2(ref) {
|
|
1405
1404
|
const base = import_node_path6.default.basename(ref).toLowerCase();
|
|
1406
|
-
return base === "dockerfile" || base === "containerfile" || base.endsWith(".dockerfile")
|
|
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
|
+
var DOCKERFILE_CANDIDATES = ["Dockerfile.vercel", "Containerfile.vercel"];
|
|
1410
|
+
function findDockerfile(workPath) {
|
|
1411
|
+
return DOCKERFILE_CANDIDATES.find(
|
|
1412
|
+
(name) => (0, import_node_fs6.existsSync)(import_node_path6.default.join(workPath, name))
|
|
1413
|
+
);
|
|
1407
1414
|
}
|
|
1408
1415
|
function sanitizeRepository(name) {
|
|
1409
1416
|
const sanitized = name.toLowerCase().replace(/[^a-z0-9-_./]/g, "-").replace(/-+/g, "-").replace(/(^[-/.]+)|([-/.]+$)/g, "");
|
|
@@ -1568,7 +1575,7 @@ async function buildAndPushImage(params) {
|
|
|
1568
1575
|
async function resolveImageHandler(options, span) {
|
|
1569
1576
|
const { config, workPath, entrypoint, meta } = options;
|
|
1570
1577
|
const entrypointRef = readString(entrypoint);
|
|
1571
|
-
const dockerfileConfigured = entrypointRef && isDockerfileRef2(entrypointRef) ? entrypointRef :
|
|
1578
|
+
const dockerfileConfigured = entrypointRef && isDockerfileRef2(entrypointRef) ? entrypointRef : findDockerfile(workPath);
|
|
1572
1579
|
const dockerfileRel = dockerfileConfigured ?? "Dockerfile";
|
|
1573
1580
|
const dockerfilePath = import_node_path6.default.join(workPath, dockerfileRel);
|
|
1574
1581
|
const hasDockerfile = dockerfileConfigured !== void 0 || (0, import_node_fs6.existsSync)(dockerfilePath);
|
|
@@ -1603,12 +1610,9 @@ async function resolveImageHandler(options, span) {
|
|
|
1603
1610
|
);
|
|
1604
1611
|
}
|
|
1605
1612
|
const serviceName = options.service?.name;
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
);
|
|
1610
|
-
}
|
|
1611
|
-
const repository = sanitizeRepository(serviceName);
|
|
1613
|
+
const repository = sanitizeRepository(
|
|
1614
|
+
serviceName ?? import_node_path6.default.basename(dockerfileRel).split(".")[0]
|
|
1615
|
+
);
|
|
1612
1616
|
const tag = resolveImageTag();
|
|
1613
1617
|
const contextDir = import_node_path6.default.dirname(dockerfilePath);
|
|
1614
1618
|
const buildArgs = buildArgsFromEnv(meta?.buildEnv);
|
|
@@ -1646,10 +1650,14 @@ async function build(options) {
|
|
|
1646
1650
|
(span) => resolveImageHandler(options, span)
|
|
1647
1651
|
);
|
|
1648
1652
|
const command = normalizeCommand2(options.config.command);
|
|
1649
|
-
const
|
|
1653
|
+
const routes = [
|
|
1654
|
+
{ handle: "filesystem" },
|
|
1655
|
+
{ src: "/(.*)", dest: "/index" }
|
|
1656
|
+
];
|
|
1650
1657
|
return {
|
|
1658
|
+
routes,
|
|
1651
1659
|
output: {
|
|
1652
|
-
|
|
1660
|
+
index: {
|
|
1653
1661
|
type: "Lambda",
|
|
1654
1662
|
files: {},
|
|
1655
1663
|
// For `runtime: 'container'` the OCI image reference is carried in
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/container",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"homepage": "https://vercel.com/docs",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/node": "20.11.0",
|
|
17
17
|
"vitest": "2.0.3",
|
|
18
|
-
"@vercel/build-utils": "13.32.
|
|
18
|
+
"@vercel/build-utils": "13.32.1"
|
|
19
19
|
},
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public"
|