envygeeks / jekyll-docker

⛴ Docker images, and CI builders for Jekyll.
ISC License
998 stars 282 forks source link

Extra docker volume to reduce jekyll s startup time #290

Open iggyzap opened 4 years ago

iggyzap commented 4 years ago

Hi,

I've observed bundler behaviour when it was re-populating gems on every start with suggested command line docker run --rm --volume "${PWD}:/srv/jekyll" -it jekyll/builder:4.1.0 s.

So I poked around and changed command line to following: docker run --rm --volume "${PWD}:/srv/jekyll" -v "iggyzap-jekyll-cache:/usr/local/bundle" -v "iggyzap-gems:/usr/gem" -it -p 4000:4000 jekyll/builder:4.1.0 jekyll s --incremental

Volume that interests us is -v "iggyzap-gems:/usr/gem" which serves as additional cache for bundler. After adding this volume jekyll container starts almost instantaneously!

Wonder if you can add this to documentation ?

I can also create PR if needed.

With regards, Ignat Zapolsky

VitaliiTsilnyk commented 3 years ago

I believe this is because for some reason jekyll-docker runs chown -R jekyll:jekyll /usr/gem every time you call the bundle command. So even something as simple as bundle config --global frozen 1 ends up running for 5+ minutes on my CI machine. And I can't even move this folder into an external volume because I don't have control over the machine, it's a DinD setup. I guess I'll look for other ways to run Jekyll in Docker.