jekyll-docker
jekyll-docker copied to clipboard
Webrick gem not included anymore
I noticed that new build for my website started failing suddenly with a cannot load such file -- webrick (LoadError)
.
I pulled the latest jekyll/jekyll:4.2.2
image and can reproduce the issue:
❯ docker pull jekyll/jekyll:4.2.2
4.2.2: Pulling from jekyll/jekyll
df9b9388f04a: Already exists
837e9cfc7e43: Already exists
c7850f1a8c23: Already exists
6ca4c39baa3d: Already exists
daa3a8cb79d3: Already exists
460c88d0f36d: Already exists
Digest: sha256:5776c8eed572003d9ec021767d725b6aa37226bebf4a5219049c063ff8b698ef
Status: Downloaded newer image for jekyll/jekyll:4.2.2
docker.io/jekyll/jekyll:4.2.2
❯ docker run --rm -it jekyll/jekyll:4.2.2 bash
bash-5.1# jekyll serve
ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux-musl]
Configuration file: none
Source: /srv/jekyll
Destination: /srv/jekyll/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 0.006 seconds.
Auto-regeneration: enabled for '/srv/jekyll'
------------------------------------------------
Jekyll 4.2.2 Please append `--trace` to the `serve` command
for any additional information or backtrace.
------------------------------------------------
<internal:/usr/local/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- webrick (LoadError)
from <internal:/usr/local/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /usr/gem/gems/jekyll-4.2.2/lib/jekyll/commands/serve/servlet.rb:3:in `<top (required)>'
from /usr/gem/gems/jekyll-4.2.2/lib/jekyll/commands/serve.rb:179:in `require_relative'
from /usr/gem/gems/jekyll-4.2.2/lib/jekyll/commands/serve.rb:179:in `setup'
from /usr/gem/gems/jekyll-4.2.2/lib/jekyll/commands/serve.rb:100:in `process'
from /usr/gem/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
from /usr/gem/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `each'
from /usr/gem/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
from /usr/gem/gems/jekyll-4.2.2/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
from /usr/gem/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
from /usr/gem/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
from /usr/gem/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
from /usr/gem/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
from /usr/gem/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
from /usr/gem/gems/jekyll-4.2.2/exe/jekyll:15:in `<top (required)>'
from /usr/gem/bin/jekyll:25:in `load'
from /usr/gem/bin/jekyll:25:in `<main>'
bash-5.1# gem list | grep webr
bash-5.1#
Before I pulled the latest jekyll/jekyll:4.2.2
image today I tried the one I had from earlier and that one inlcuded webrick as it should.
I noticed that the jekyll/jekyll:4.2.2 image got updated 3 days ago (April 10, 6:13am) so I wonder if this was the time where an image without webrick was pushed ? Is this related to the Update to ruby:3.1.1-alpine3.15 commit?
I'm super happy so far with the image, but I would propose not to update existing image tag and rather use a different tag for updates in order to avoid such regressions.
I simply put a new line in the file Gemfile
:
gem "webrick"
Then it works.
I ran into this issue as well with latest. @shinyzhu can you explain more your workaround? Which Gemfile? As of now I don't have a gemfile as I wanted to just use the docker container w/o having to install ruby etc. One work-around is to pin to 4.2.0 instead.
I simply put a new line in the file
Gemfile
:
gem "webrick"
Then it works.
Thanks for the hint to this workaround. That's how I solved it as well, as temporary fix. However, I still would prefer having webrick installed as default to reduce startup container times.
I could fix it adding the webrick and other dependencies, see code below:
RUN bundle init
RUN touch Gemfile.lock
RUN chmod a+w Gemfile.lock
RUN chmod 777 Gemfile
RUN bundle add webrick
RUN bundle add rouge
RUN bundle jekyll-watch
A few notes:
- I'm using the docker image
jekyll/jekyll
, so it was needed to initialize the bundle - I had to give permissions for the Gemfile and Gemfile.lock, it wasn't possible to add the dependencies without give them permissions
Maybe you folks don't need to add all those commands, but in case you faced with those issues, you can try out it
This project has been published broken for 4 months. Could be time to fork and/or move on.
@envygeeks Do you need someone to help you release this image? This is something I use and would be willing to put in some hours towards.
~I've a working version with docker compose now.~
Actually i've given up hope and transfered to https://github.com/BretFisher/jekyll-serve - which works out of the box and (seems) to be more actively maintained.
Cheers!