You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Directories with a dot as the first character of the directory name not included in published container images #40511
If a web application is published as a container image and the application contains any directories that have a name prefixed with a . character, for example wwwroot/.well-known, the directory and all the files within are not copied to the resulting Docker image.
This only appears to occur on Linux - on Windows the files are in the container image as expected.
If a non-container publish is performed, the expected directories and files can be seen in the published application.
By default, EnumerationOptions.AttributesToSkip has a value of FileAttributes.Hidden | FileAttributes.System. On Linux, such directories are considered to be hidden (if my memory of hitting this problem before in Pester is correct pester/Pester#2327), so such directories are not copied into the tar files.
If my hunch is correct, this would be fixed with the following change:
options: new EnumerationOptions()
{
+ AttributesToSkip = FileAttributes.System, // Include hidden files
RecurseSubdirectories = true
});
Run the following command from the root directory of the repository on Linux: dotnet publish ./src/Website --arch x64 --os linux -p:PublishProfile=DefaultContainer /p:ContainerArchiveOutputPath=./artifacts/images/repro.tar.gz
Extract the repro.tar.gz file and the layers to view the contents of the layer containing the app directory.
Observe that the app/wwwroot folder does not contain a .well-known directory.
Solid analysis, I agree with your assessment here. We should include all files in the publish directory in the container image without existing any kind of opinion about the contents.
Once I've unblocked myself in the original app I hit this with, I'll circle back later today and see about doing the fix (and #40501). I imagine testing it E2E is probably going to be the slightly more involved piece here if that one-liner is indeed the fix.
Activity
baronfel commentedon Apr 28, 2024
Solid analysis, I agree with your assessment here. We should include all files in the publish directory in the container image without existing any kind of opinion about the contents.
martincostello commentedon Apr 28, 2024
Once I've unblocked myself in the original app I hit this with, I'll circle back later today and see about doing the fix (and #40501). I imagine testing it E2E is probably going to be the slightly more involved piece here if that one-liner is indeed the fix.
Add test for hidden directory issue
Add test for hidden directory issue