@vercel/container 24.0.1 → 25.0.0-snapshot-801db9d533c3
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 +41 -7
- package/dist/schedules-command-dispatcher +0 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -70,6 +70,7 @@ async function buildSchedulesCommandImage(engine, params, dispatcher = (0, impor
|
|
|
70
70
|
contextDir,
|
|
71
71
|
dockerfilePath,
|
|
72
72
|
buildArgs: void 0,
|
|
73
|
+
buildTarget: void 0,
|
|
73
74
|
baseImageIsLocal: true
|
|
74
75
|
});
|
|
75
76
|
} finally {
|
|
@@ -173,6 +174,11 @@ function toTag(value) {
|
|
|
173
174
|
function readString(value) {
|
|
174
175
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
175
176
|
}
|
|
177
|
+
function resolveBuildTarget(config) {
|
|
178
|
+
return readString(
|
|
179
|
+
config.daemon ? config.daemon.buildTarget : config.buildTarget
|
|
180
|
+
);
|
|
181
|
+
}
|
|
176
182
|
function isDockerfileRef(ref) {
|
|
177
183
|
return /(docker|container)file/i.test((0, import_node_path2.basename)(ref));
|
|
178
184
|
}
|
|
@@ -618,6 +624,9 @@ function buildArgFlags(params) {
|
|
|
618
624
|
}
|
|
619
625
|
return flags;
|
|
620
626
|
}
|
|
627
|
+
function buildTargetFlags(params) {
|
|
628
|
+
return params.buildTarget ? ["--target", params.buildTarget] : [];
|
|
629
|
+
}
|
|
621
630
|
|
|
622
631
|
// src/registry.ts
|
|
623
632
|
async function resolveRegistryTarget(params) {
|
|
@@ -908,6 +917,7 @@ function createBuildahEngine(client) {
|
|
|
908
917
|
"--network",
|
|
909
918
|
"host",
|
|
910
919
|
...buildArgFlags(params),
|
|
920
|
+
...buildTargetFlags(params),
|
|
911
921
|
"-t",
|
|
912
922
|
localImageRef(params),
|
|
913
923
|
"-f",
|
|
@@ -1262,6 +1272,7 @@ ${version2.trim()}`);
|
|
|
1262
1272
|
"--platform",
|
|
1263
1273
|
TARGET_PLATFORM,
|
|
1264
1274
|
...buildArgFlags(params),
|
|
1275
|
+
...buildTargetFlags(params),
|
|
1265
1276
|
"-t",
|
|
1266
1277
|
params.imageRef,
|
|
1267
1278
|
"-f",
|
|
@@ -3762,7 +3773,7 @@ async function resolveDevImage(options, out, span) {
|
|
|
3762
3773
|
}
|
|
3763
3774
|
const serviceName = options.service?.name ?? "service";
|
|
3764
3775
|
const tag = devImageTag(serviceName);
|
|
3765
|
-
const contextDir = import_node_path21.default.dirname(dockerfilePath);
|
|
3776
|
+
const contextDir = options.service ? options.workPath : import_node_path21.default.dirname(dockerfilePath);
|
|
3766
3777
|
const buildArgFlags2 = [];
|
|
3767
3778
|
const buildEnv = options.meta?.buildEnv ?? {};
|
|
3768
3779
|
for (const [key, value] of Object.entries(buildEnv)) {
|
|
@@ -3770,11 +3781,24 @@ async function resolveDevImage(options, out, span) {
|
|
|
3770
3781
|
buildArgFlags2.push("--build-arg", `${key}=${value}`);
|
|
3771
3782
|
}
|
|
3772
3783
|
}
|
|
3784
|
+
const buildTarget = resolveBuildTarget(options.config);
|
|
3773
3785
|
span?.setAttributes({ "container.dev_mode": "build", "image.tag": tag });
|
|
3774
|
-
emit(
|
|
3786
|
+
emit(
|
|
3787
|
+
out,
|
|
3788
|
+
`\u25B2 container vercel dev: building ${tag} (docker, host platform${buildTarget ? `, target ${buildTarget}` : ""})`
|
|
3789
|
+
);
|
|
3775
3790
|
await runForwarded(
|
|
3776
3791
|
"docker",
|
|
3777
|
-
[
|
|
3792
|
+
[
|
|
3793
|
+
"build",
|
|
3794
|
+
...buildArgFlags2,
|
|
3795
|
+
...buildTargetFlags({ buildTarget }),
|
|
3796
|
+
"-t",
|
|
3797
|
+
tag,
|
|
3798
|
+
"-f",
|
|
3799
|
+
dockerfilePath,
|
|
3800
|
+
contextDir
|
|
3801
|
+
],
|
|
3778
3802
|
out
|
|
3779
3803
|
);
|
|
3780
3804
|
emit(out, `\u25B2 container built ${tag}`);
|
|
@@ -4127,6 +4151,7 @@ async function buildAndPushImage(params) {
|
|
|
4127
4151
|
repository,
|
|
4128
4152
|
tag,
|
|
4129
4153
|
buildArgs,
|
|
4154
|
+
buildTarget,
|
|
4130
4155
|
buildahClient,
|
|
4131
4156
|
parentSpan
|
|
4132
4157
|
} = params;
|
|
@@ -4180,6 +4205,7 @@ async function buildAndPushImage(params) {
|
|
|
4180
4205
|
token,
|
|
4181
4206
|
repository,
|
|
4182
4207
|
buildArgs,
|
|
4208
|
+
buildTarget,
|
|
4183
4209
|
useBuildahStoreCache: buildahStoreCacheEnabled(),
|
|
4184
4210
|
span: buildSpan
|
|
4185
4211
|
};
|
|
@@ -4194,15 +4220,22 @@ async function buildAndPushImage(params) {
|
|
|
4194
4220
|
debug(`dockerfile: ${dockerfilePath}`);
|
|
4195
4221
|
debug(`context: ${contextDir}`);
|
|
4196
4222
|
debug(`platform: ${TARGET_PLATFORM}`);
|
|
4223
|
+
debug(`target: ${buildTarget ?? "(last stage)"}`);
|
|
4197
4224
|
debug(
|
|
4198
4225
|
`build args: ${buildArgs ? Object.keys(buildArgs).length : 0} (from project build env)`
|
|
4199
4226
|
);
|
|
4200
4227
|
const buildStart = Date.now();
|
|
4201
|
-
step(
|
|
4228
|
+
step(
|
|
4229
|
+
`${engine.name} build (${TARGET_PLATFORM}${buildTarget ? `, target ${buildTarget}` : ""})`
|
|
4230
|
+
);
|
|
4202
4231
|
await withSpan(
|
|
4203
4232
|
buildSpan,
|
|
4204
4233
|
"container.image_build",
|
|
4205
|
-
{
|
|
4234
|
+
{
|
|
4235
|
+
"image.ref": imageRef,
|
|
4236
|
+
"image.platform": TARGET_PLATFORM,
|
|
4237
|
+
"image.build_target": buildTarget
|
|
4238
|
+
},
|
|
4206
4239
|
async () => {
|
|
4207
4240
|
if (params.schedulesCommand) {
|
|
4208
4241
|
await buildSchedulesCommandImage(engine, buildParams);
|
|
@@ -4334,8 +4367,8 @@ async function resolveImageHandler(options, source, buildahClient, span, schedul
|
|
|
4334
4367
|
options.service?.name ?? import_node_path23.default.basename(dockerfileRel).split(".")[0]
|
|
4335
4368
|
);
|
|
4336
4369
|
const tag = resolveImageTag();
|
|
4337
|
-
const contextDir = daemon ? resolveDaemonContextDir(options, daemon) : schedulesCommand ?
|
|
4338
|
-
const contextIsRoot = Boolean(daemon || schedulesCommand) || import_node_path23.default.dirname(import_node_path23.default.normalize(dockerfileRel)) === ".";
|
|
4370
|
+
const contextDir = daemon ? resolveDaemonContextDir(options, daemon) : schedulesCommand || options.service ? options.workPath : import_node_path23.default.dirname(dockerfilePath);
|
|
4371
|
+
const contextIsRoot = Boolean(daemon || schedulesCommand || options.service) || import_node_path23.default.dirname(import_node_path23.default.normalize(dockerfileRel)) === ".";
|
|
4339
4372
|
const buildArgs = buildArgsFromEnv(meta?.buildEnv);
|
|
4340
4373
|
span?.setAttributes({
|
|
4341
4374
|
"container.mode": "build_and_push",
|
|
@@ -4349,6 +4382,7 @@ async function resolveImageHandler(options, source, buildahClient, span, schedul
|
|
|
4349
4382
|
repository,
|
|
4350
4383
|
tag,
|
|
4351
4384
|
buildArgs,
|
|
4385
|
+
buildTarget: resolveBuildTarget(options.config),
|
|
4352
4386
|
buildahClient,
|
|
4353
4387
|
parentSpan: span,
|
|
4354
4388
|
schedulesCommand
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/container",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0-snapshot-801db9d533c3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"homepage": "https://vercel.com/docs",
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"tar": "7.5.11"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@vercel/build-utils": "15.
|
|
20
|
+
"@vercel/build-utils": "15.3.0-snapshot-801db9d533c3"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "20.11.0",
|
|
24
24
|
"vitest": "4.1.10",
|
|
25
25
|
"@vercel-internals/ipc-proxy": "1.1.1",
|
|
26
|
-
"@vercel/build-utils": "15.
|
|
26
|
+
"@vercel/build-utils": "15.3.0-snapshot-801db9d533c3"
|
|
27
27
|
},
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|