@@ -267,6 +267,7 @@ async function provision({
267267 useBuildKit : buildkit ,
268268 buildxPlatform : undefined ,
269269 buildxPush : false ,
270+ buildxLabel : undefined ,
270271 buildxOutput : undefined ,
271272 buildxCacheTo : addCacheTo ,
272273 additionalFeatures,
@@ -431,6 +432,7 @@ async function doSetUp({
431432 useBuildKit : 'auto' ,
432433 buildxPlatform : undefined ,
433434 buildxPush : false ,
435+ buildxLabel : undefined ,
434436 buildxOutput : undefined ,
435437 buildxCacheTo : undefined ,
436438 skipFeatureAutoMapping : false ,
@@ -508,6 +510,7 @@ function buildOptions(y: Argv) {
508510 'buildkit' : { choices : [ 'auto' as 'auto' , 'never' as 'never' ] , default : 'auto' as 'auto' , description : 'Control whether BuildKit should be used' } ,
509511 'platform' : { type : 'string' , description : 'Set target platforms.' } ,
510512 'push' : { type : 'boolean' , default : false , description : 'Push to a container registry.' } ,
513+ 'label' : { type : 'string' , description : 'Provide key and value for the metadata of the container. (<key1>=<value1> <key2>=<value2> )' } ,
511514 'output' : { type : 'string' , description : 'Overrides the default behavior to load built images into the local docker registry. Valid options are the same ones provided to the --output option of docker buildx build.' } ,
512515 'additional-features' : { type : 'string' , description : 'Additional features to apply to the dev container (JSON as per "features" section in devcontainer.json)' } ,
513516 'skip-feature-auto-mapping' : { type : 'boolean' , default : false , hidden : true , description : 'Temporary option for testing.' } ,
@@ -546,6 +549,7 @@ async function doBuild({
546549 'buildkit' : buildkit ,
547550 'platform' : buildxPlatform ,
548551 'push' : buildxPush ,
552+ 'label' : buildxLabel ,
549553 'output' : buildxOutput ,
550554 'cache-to' : buildxCacheTo ,
551555 'additional-features' : additionalFeaturesJson ,
@@ -593,6 +597,7 @@ async function doBuild({
593597 useBuildKit : buildkit ,
594598 buildxPlatform,
595599 buildxPush,
600+ buildxLabel,
596601 buildxOutput,
597602 buildxCacheTo,
598603 skipFeatureAutoMapping,
@@ -629,10 +634,13 @@ async function doBuild({
629634 // Support multiple use of `--image-name`
630635 const imageNames = ( argImageName && ( Array . isArray ( argImageName ) ? argImageName : [ argImageName ] ) as string [ ] ) || undefined ;
631636
637+ // Support multiple use of `--label`
638+ const imageLabels = ( buildxLabel && ( Array . isArray ( buildxLabel ) ? buildxLabel : [ buildxLabel ] ) as string [ ] ) || undefined ;
639+
632640 if ( isDockerFileConfig ( config ) ) {
633641
634642 // Build the base image and extend with features etc.
635- let { updatedImageName } = await buildNamedImageAndExtend ( params , configWithRaw as SubstitutedConfig < DevContainerFromDockerfileConfig > , additionalFeatures , false , imageNames ) ;
643+ let { updatedImageName } = await buildNamedImageAndExtend ( params , configWithRaw as SubstitutedConfig < DevContainerFromDockerfileConfig > , additionalFeatures , false , imageNames , imageLabels ) ;
636644
637645 if ( imageNames ) {
638646 imageNameResult = imageNames ;
@@ -695,7 +703,7 @@ async function doBuild({
695703 }
696704
697705 await inspectDockerImage ( params , config . image , true ) ;
698- const { updatedImageName } = await extendImage ( params , configWithRaw , config . image , imageNames || [ ] , additionalFeatures , false ) ;
706+ const { updatedImageName } = await extendImage ( params , configWithRaw , config . image , imageNames || [ ] , imageLabels || [ ] , additionalFeatures , false ) ;
699707
700708 if ( imageNames ) {
701709 imageNameResult = imageNames ;
@@ -858,6 +866,7 @@ async function doRunUserCommands({
858866 useBuildKit : 'auto' ,
859867 buildxPlatform : undefined ,
860868 buildxPush : false ,
869+ buildxLabel : undefined ,
861870 buildxOutput : undefined ,
862871 buildxCacheTo : undefined ,
863872 skipFeatureAutoMapping,
@@ -1306,6 +1315,7 @@ export async function doExec({
13061315 omitLoggerHeader : true ,
13071316 buildxPlatform : undefined ,
13081317 buildxPush : false ,
1318+ buildxLabel : undefined ,
13091319 buildxCacheTo : undefined ,
13101320 skipFeatureAutoMapping,
13111321 buildxOutput : undefined ,
0 commit comments