Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devops: do cache busting for APT #2656

Merged
merged 1 commit into from
Jun 22, 2020

Conversation

aslushnikov
Copy link
Collaborator

To avoid caching old package lists, every apt-get install
should be prefixed with apt-get update.

More info on the matter:

To avoid caching old package lists, every `apt-get install`
should be prefixed with `apt-get update`.

More info on the matter:
- https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#apt-get
- moby/moby#3313
@aslushnikov aslushnikov requested a review from yury-s June 20, 2020 03:11
Copy link
Member

@mxschmitt mxschmitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's even better to reduce the steps to a single apt call?

@yury-s
Copy link
Member

yury-s commented Jun 20, 2020

Agreed, we should probably combine all apt installs into one because apt-get update is not the fastest step and calling it multiple times slows down no-cache build(probably insignificantly but still:), at the same time whenever we add a new dependency we want everything to be consistent and up to date.

I believe the only reason of the split commands is readability which we could achieve with proper formatting. In any case could be done in a separate PR if you prefer.

@aslushnikov aslushnikov merged commit bb34418 into microsoft:master Jun 22, 2020
@aslushnikov aslushnikov deleted the fix-docker-image branch June 22, 2020 22:54
aslushnikov added a commit that referenced this pull request Jul 14, 2020
This adds a new script to calculate docker image size with
all parent layers.

Note: take this metrics with a grain of salt, since in reality
docker compresses and reuses layers.

Some historic stats obtained with this script:
- **`208MB`** (-33MB) chore(docker): skip "recommended" dependencies (#2917) (1cebf87)
- **`241MB`** (-29MB) chore(docker): trim some of the gstreamer dependencies (#2897) (bce4b1a)
- **`272MB`** (-1MB) devops: do cache busting for APT (#2656) (bb34418)
- **`273MB`** (+49MB) fix(webkit): update Docker file to include gstreamer (#2636) (5c6c659)
- **`224MB`** (+0MB) chore: fix emojis for CR and FF in Dockerfile (#2522) (24316ad)
- **`224MB`** (-1MB) fix: Dockerfile for Firefox (#1937) (b516ac4)
- **`225MB`** (+49MB) devops(docker): Install ffmpeg dependency, adding codecs necessary for video playback in Firefox (#1627) (222d01c)
-  **`176MB`** (+32MB) chore(docs): optionally install XVFB in docker(ec3ee66)
-  **`144MB`** (+144MB)  feat: add a playwright-ready docker image (#1161)(1781ae7)
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.

3 participants