envygeeks / jekyll-docker

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

Unnecessary bundle install during build time? #158

Closed augnustin closed 7 years ago

augnustin commented 7 years ago

I'm not exactly sure why, but it happens every time I run the command jekyll, the whole bundle gets updated, slowing down the build process a lot:

Here's what I get when I simply run jekyll -v:

bash-4.3# jekyll -v
fetch http://mirror.envygeeks.io/alpine/v3.5/main/x86_64/APKINDEX.tar.gz
fetch http://mirror.envygeeks.io/alpine/v3.5/community/x86_64/APKINDEX.tar.gz
fetch http://mirror.envygeeks.io/alpine/edge/community/x86_64/APKINDEX.tar.gz
fetch http://mirror.envygeeks.io/alpine/edge/testing/x86_64/APKINDEX.tar.gz
fetch http://mirror.envygeeks.io/alpine/edge/main/x86_64/APKINDEX.tar.gz
OK: 316 MiB in 92 packages
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using public_suffix 2.0.5
Using colorator 1.1.0 (was 0.1)
Using rack 1.6.8 (was 1.6.4)
Using rb-fsevent 0.9.8 (was 0.9.5)
Using ffi 1.9.18 (was 1.9.10)
Using kramdown 1.13.2 (was 1.8.0)
Using liquid 3.0.6 (was 2.6.2)
Using mercenary 0.3.6 (was 0.3.5)
Using forwardable-extended 2.6.0
Using rouge 1.11.1
Using safe_yaml 1.0.4
Using fastimage 2.1.0 (was 1.7.0)
Using concurrent-ruby 1.0.5
Using sass 3.4.24 (was 3.4.15)
Using libv8 3.16.14.19 (x86_64-linux) (was 3.16.14.11)
Using ref 2.0.0
Using execjs 2.7.0 (was 2.5.2)
Using bundler 1.15.1
Using addressable 2.5.1 (was 2.3.8)
Using rb-inotify 0.9.8 (was 0.9.5)
Using pathutil 0.14.0
Using extras 0.1.0
Using sprockets 3.6.3 (was 2.12.4)
Using jekyll-sass-converter 1.5.0 (was 1.3.0)
Using therubyracer 0.12.3 (was 0.12.2)
Using uglifier 3.2.0 (was 2.7.1)
Using listen 3.0.8 (was 2.10.1)
Using jekyll-watch 1.5.0 (was 1.2.1)
Using jekyll 3.4.3 (was 2.5.3)
Using jekyll-assets 2.2.8 (was 0.14.0)
Bundle updated!
jekyll 3.4.3

This doesn't feel like the expected behavior.

How are we supposed to handle situation where bundle install is required? Writing it into Dockerfile doesn't seem to do the trick:

FROM jekyll/jekyll

RUN apk add --update nodejs
RUN apk add --update imagemagick

WORKDIR /srv/jekyll

ADD Gemfile .

RUN bundle install
RUN npm install

Thanks

envygeeks commented 7 years ago

If you would look at the code you would notice this is exactly the expected behavior. I'll address the rest of your concerns when your ticket approaches this repository with respect.

augnustin commented 7 years ago

Thanks for coming back.

You must have misinterpreted my message: I never intended to disrespect this repository, and I hardly see why you thought so, besides maybe the use of the term useless which was inappropriate and the lack of question mark. Apologies for that.

I've had a look at the code. I get what is going on, but I'm not sure this makes sense to me: shouldn't be the bundle update at docker build time instead of docker runtime? What if the updated gems have regressions that don't get caught by the user because everything was working fine during previous version?

IMHO there should an option to unplug this behavior for those who prefer to keep control and this should be documented.

Let me know if I can help.

envygeeks commented 7 years ago

@aug-riedinger CONNECTED=false will disable bundle update. As far as anything else bundler now has bundle check which is something we plan to move to so that we can simply just bundle install. Back when this was first written there was no check on bundle which forced us to always update because that was the only thing that would install without edgy errors if there was something entirely broken within bundler.

augnustin commented 7 years ago

Thanks for clarification.

envygeeks commented 7 years ago

The move to bundle check || bundle install has been done.