pages-gem icon indicating copy to clipboard operation
pages-gem copied to clipboard

Running with docker image does not work out-of-the-box

Open pmarinova opened this issue 8 months ago • 1 comments

Before submitting an issue, please be sure to

This issue affects

  • [ ] The site generated by GitHub Pages
  • [x] Building sites locally

What did you do (e.g., steps to reproduce)

Attempting to use the github-pages gem using the docker image with the instructions from the README does not work out-of-the-box, for example:

git clone https://github.com/github/pages-gem
cd pages-gem
git checkout v228
docker build -t gh-pages .
cd ..
git clone https://github.com/github/personal-website
cd personal-website
docker run --rm -it -p 4000:4000 -v ${PWD}:/src/site gh-pages

What did you expect to happen?

To be able to run the site locally at localhost:4000

What happened instead?

I got the following error:

Traceback (most recent call last):
        17: from /usr/local/bundle/bin/jekyll:25:in `<main>'
        16: from /usr/local/bundle/bin/jekyll:25:in `load'
        15: from /usr/local/bundle/gems/jekyll-3.9.3/exe/jekyll:11:in `<top (required)>'
        14: from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/plugin_manager.rb:50:in `require_from_bundler'
        13: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler.rb:162:in `setup'
        12: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:18:in `setup'
        11: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/definition.rb:266:in `specs_for'
        10: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/definition.rb:200:in `specs'
         9: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/definition.rb:523:in `materialize'
         8: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/definition.rb:301:in `resolve'
         7: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/definition.rb:570:in `start_resolution'
         6: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/resolver.rb:28:in `start'
         5: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/resolver.rb:61:in `setup_solver'
         4: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/resolver.rb:357:in `prepare_dependencies'
         3: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/resolver.rb:357:in `map'
         2: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/resolver.rb:357:in `each'
         1: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/resolver.rb:372:in `block in prepare_dependencies'
/usr/local/lib/ruby/site_ruby/2.7.0/bundler/resolver.rb:312:in `raise_not_found!': Could not find gem 'github-pages' in locally installed gems. (Bundler::GemNotFound)

Additional information

The only way I could get it working was by running bundle install before jekyll serve:

docker run --rm -it \
    -p 4000:4000 \
    -v ${PWD}:/src/site \
    gh-pages \
    sh -c "bundle install && jekyll serve -H 0.0.0.0 -P 4000"

Shouldn't the github-pages gem be already preinstalled in the docker image?

pmarinova avatar Oct 13 '23 06:10 pmarinova