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

Optimize layers #42

Merged
merged 1 commit into from
May 7, 2024
Merged

Conversation

LaurentGoderre
Copy link
Contributor

Collpase installation layers and image went from 550Mb to 370mb

Collpase installation layers and image went from 550Mb to 370mb
# Install required libs
RUN set -ex; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
# Install required libs

Choose a reason for hiding this comment

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

Why would you move this?

Comment on lines -6 to +11
# Install php libs
RUN set -ex; \
\
aptMarkList="$(apt-mark showmanual)"; \
\
apt-get update; \
# Install php libs

Choose a reason for hiding this comment

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

The whole thing is about PHP, so may not move this?

@LaurentGoderre
Copy link
Contributor Author

@whalelines the answer to both questions is that the second install step relies on the cache not being cleared in the previous step. So either we duplicate the update and clear cache or we put them in the same layer. The latter is faster to build

@whalelines
Copy link

But if you are combining those two RUN steps into one, why would you run the purge step at all in the middle of it?

@LaurentGoderre
Copy link
Contributor Author

That purge gets rids of build dependencies for the PHP deps which is not the same as the cache.

@tmachyshyn tmachyshyn merged commit b5a4db9 into espocrm:master May 7, 2024
@tmachyshyn
Copy link
Collaborator

@LaurentGoderre thanks for your contribution

@LaurentGoderre LaurentGoderre deleted the optimize-layers branch May 7, 2024 13:20
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