@@ -293,15 +293,21 @@ export function getFeatureLayers(featuresConfig: FeaturesConfig, containerUser:
293
293
294
294
const useSELinuxLabel = process . platform === 'linux' && isBuildah ;
295
295
const builtinsEnvFile = `${ path . posix . join ( FEATURES_CONTAINER_TEMP_DEST_FOLDER , 'devcontainer-features.builtin.env' ) } ` ;
296
- let result = `RUN \\
296
+ const tempUserHome = `RUN \\
297
297
echo "_CONTAINER_USER_HOME=$(${ getEntPasswdShellCommand ( containerUser ) } | cut -d: -f6)" >> ${ builtinsEnvFile } && \\
298
298
echo "_REMOTE_USER_HOME=$(${ getEntPasswdShellCommand ( remoteUser ) } | cut -d: -f6)" >> ${ builtinsEnvFile }
299
299
300
300
` ;
301
301
302
+ // placeholder empty string to concatenate the feature layers
303
+ let result = '' ;
304
+
302
305
// Features version 1
303
306
const folders = ( featuresConfig . featureSets || [ ] ) . filter ( y => y . internalVersion !== '2' ) . map ( x => x . features [ 0 ] . consecutiveId ) ;
304
307
folders . forEach ( folder => {
308
+ // calculate container user home and remote user home before feature installation
309
+ result += tempUserHome ;
310
+
305
311
const source = path . posix . join ( contentSourceRootPath , folder ! ) ;
306
312
const dest = path . posix . join ( FEATURES_CONTAINER_TEMP_DEST_FOLDER , folder ! ) ;
307
313
if ( ! useBuildKitBuildContexts ) {
@@ -327,6 +333,9 @@ RUN chmod -R 0755 ${dest} \\
327
333
// Features version 2
328
334
featuresConfig . featureSets . filter ( y => y . internalVersion === '2' ) . forEach ( featureSet => {
329
335
featureSet . features . forEach ( feature => {
336
+ // recalculate container user home and remote user home if feature modifies it
337
+ result += tempUserHome ;
338
+
330
339
result += generateContainerEnvs ( feature . containerEnv ) ;
331
340
const source = path . posix . join ( contentSourceRootPath , feature . consecutiveId ! ) ;
332
341
const dest = path . posix . join ( FEATURES_CONTAINER_TEMP_DEST_FOLDER , feature . consecutiveId ! ) ;
0 commit comments