Skip to content

fix(docker): keep the pip cache out of the image layers, and check the layers - #3350

Merged
Yury Semikhatsky (yury-s) merged 3 commits into
microsoft:mainfrom
yury-s:docker-check-layers
Nov 17, 2026
Merged

Yury Semikhatsky (yury-s) merged 3 commits into
microsoft:mainfrom
yury-s:docker-check-layers

Conversation

@yury-s

@yury-s Yury Semikhatsky (yury-s) commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The image layers kept ~/.cache/pip and ~/.cache/virtualenv. Point the cache to /dev/shm during the build with a build ARG XDG_CACHE_HOME. It is a tmpfs, so no layer keeps the files. The image itself still uses the default ~/.cache.
  • Add utils/docker/check_layers.js and run it from build.sh after each build. It fails when a layer has files that a build step must not leave behind: package manager caches, npm logs, .git. It reads each layer, so it also finds files that a later layer deletes. The same file is in microsoft/playwright.
  • Add utils/docker/test_check_layers.sh to the Docker tests.
  • Scan the built image for secrets with Trivy in the Docker tests.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@yury-s
Yury Semikhatsky (yury-s) merged commit 9e77158 into microsoft:main Nov 17, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants