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

Make Dockerfile more efficient for caching and add yarn #73

Closed
wants to merge 2 commits into from

Conversation

noeljackson
Copy link

I've updated the Dockerfile to split up package installation and removal, as well as decreasing build times, by having npm install cached separately, then copied over. This Dockerfile allows docker-compose to work more efficiently as well. I installed yarn for increased speed and also to allow development work to take place if using docker run -it for example.

@leebenson
Copy link
Member

@noeljackson - I swapped yarn for npm's package-lock.json in a previous commit, because there were issues installing various binary packages that relied on NPM's post-install step (that, at least at the time, yarn didn't execute.)

Do you know if those legacy issues have been solved in yarn?

@noeljackson
Copy link
Author

@leebenson Yes, these have been fixed over here: yarnpkg/yarn#800 :)

@ghost
Copy link

ghost commented Sep 9, 2017

In my personal tests, npm 5.x is actually faster and gives better results than yarn.

@noeljackson
Copy link
Author

noeljackson commented Sep 9, 2017 via email

@leebenson
Copy link
Member

Please re-commit without yarn. That keeps consistency with the project's 'package-lock.json'

@leebenson
Copy link
Member

@noeljackson - after inspecting this some more, one issue with your Dockerfile version is that the RUN apt-get remove --purge -y ${EPHIMERAL_PACKAGES} is moot-- by the time that command is run, the original image size has already been inflated by the packages already installed. That's why the default Dockerfile does the package bundling, installation and tear-down, as a single step.

So it solves caching, but the image is much bigger. So it's a toss-up between which is more important to your build environment.

@leebenson
Copy link
Member

I'll play about with the Dockerfile later and attempt to optimise for caching, whilst keeping the size pretty low.

@leebenson leebenson closed this Sep 13, 2017
@noeljackson
Copy link
Author

@leebenson There are some other issues as well, when using the current and the proposed Dockerfile in production, though I've fixed those. I will tinker and see what's the best I can come up with. Cheers.

@leebenson
Copy link
Member

Thanks @noeljackson.

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