@@ -218,32 +218,22 @@ export function getSourceInfoString(srcInfo: SourceInformation): string {
218218}
219219
220220// TODO: Move to node layer.
221- export function getContainerFeaturesBaseDockerFile ( useBuildKitBuildContexts = false ) {
221+ export function getContainerFeaturesBaseDockerFile ( ) {
222222 return `
223223#{featureBuildStages}
224224
225225#{nonBuildKitFeatureContentFallback}
226- ${ ( ( ) => {
227- return useBuildKitBuildContexts ? `` : `
226+
228227FROM $_DEV_CONTAINERS_BASE_IMAGE AS dev_containers_feature_content_normalize
229228USER root
230- COPY --from=dev_containers_feature_content_source {contentSourceRootPath} /tmp/build-features/
229+ COPY --from=dev_containers_feature_content_source {contentSourceRootPath}/devcontainer-features.builtin.env /tmp/build-features/
231230RUN chmod -R 0700 /tmp/build-features
232- ` ;
233- } ) ( ) }
234231
235232FROM $_DEV_CONTAINERS_BASE_IMAGE AS dev_containers_target_stage
236233
237234USER root
238235
239- ${ ( ( ) => {
240- return useBuildKitBuildContexts ? `
241- COPY --from=dev_containers_feature_content_source {contentSourceRootPath}/devcontainer-features.builtin.env /tmp/build-features/
242- RUN chmod -R 0700 /tmp/build-features
243- ` : `
244236COPY --from=dev_containers_feature_content_normalize /tmp/build-features /tmp/build-features
245- ` ;
246- } ) ( ) }
247237
248238#{featureLayer}
249239
@@ -330,16 +320,19 @@ echo "_REMOTE_USER_HOME=$(getent passwd ${remoteUser} | cut -d: -f6)" >> /tmp/bu
330320 // Features version 1
331321 const folders = ( featuresConfig . featureSets || [ ] ) . filter ( y => y . internalVersion !== '2' ) . map ( x => x . features [ 0 ] . consecutiveId ) ;
332322 folders . forEach ( folder => {
323+ const source = path . posix . join ( contentSourceRootPath , folder ! ) ;
333324 if ( ! useBuildKitBuildContexts ) {
334- result += `RUN cd /tmp/build-features/${ folder } \\
325+ result += `COPY --chown=root:root --from=dev_containers_feature_content_source ${ source } /tmp/build-features/${ folder }
326+ RUN chmod -R 0700 /tmp/build-features/${ folder } \\
327+ && cd /tmp/build-features/${ folder } \\
335328&& chmod +x ./install.sh \\
336329&& ./install.sh
337330
338331` ;
339332 } else {
340- const source = path . posix . join ( contentSourceRootPath , folder ! ) ;
341333 result += `RUN --mount=type=bind,from=dev_containers_feature_content_source,source=${ source } ,target=/tmp/build-features-src/${ folder } \\
342334 cp -ar /tmp/build-features-src/${ folder } /tmp/build-features/ \\
335+ && chmod -R 0700 /tmp/build-features/${ folder } \\
343336 && cd /tmp/build-features/${ folder } \\
344337 && chmod +x ./install.sh \\
345338 && ./install.sh \\
@@ -352,18 +345,21 @@ echo "_REMOTE_USER_HOME=$(getent passwd ${remoteUser} | cut -d: -f6)" >> /tmp/bu
352345 featuresConfig . featureSets . filter ( y => y . internalVersion === '2' ) . forEach ( featureSet => {
353346 featureSet . features . forEach ( feature => {
354347 result += generateContainerEnvs ( feature ) ;
348+ const source = path . posix . join ( contentSourceRootPath , feature . consecutiveId ! ) ;
355349 if ( ! useBuildKitBuildContexts ) {
356350 result += `
357- RUN cd /tmp/build-features/${ feature . consecutiveId } \\
351+ COPY --chown=root:root --from=dev_containers_feature_content_source ${ source } /tmp/build-features/${ feature . consecutiveId }
352+ RUN chmod -R 0700 /tmp/build-features/${ feature . consecutiveId } \\
353+ && cd /tmp/build-features/${ feature . consecutiveId } \\
358354&& chmod +x ./devcontainer-features-install.sh \\
359355&& ./devcontainer-features-install.sh
360356
361357` ;
362358 } else {
363- const source = path . posix . join ( contentSourceRootPath , feature . consecutiveId ! ) ;
364359 result += `
365360RUN --mount=type=bind,from=dev_containers_feature_content_source,source=${ source } ,target=/tmp/build-features-src/${ feature . consecutiveId } \\
366361 cp -ar /tmp/build-features-src/${ feature . consecutiveId } /tmp/build-features/ \\
362+ && chmod -R 0700 /tmp/build-features/${ feature . consecutiveId } \\
367363 && cd /tmp/build-features/${ feature . consecutiveId } \\
368364 && chmod +x ./devcontainer-features-install.sh \\
369365 && ./devcontainer-features-install.sh \\
0 commit comments