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

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

Closed
2 of 4 tasks
pmarinova opened this issue Oct 13, 2023 · 2 comments · Fixed by #912
Closed
2 of 4 tasks

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

pmarinova opened this issue Oct 13, 2023 · 2 comments · Fixed by #912

Comments

@pmarinova
Copy link

Before submitting an issue, please be sure to

This issue affects

  • The site generated by GitHub Pages
  • 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
Copy link
Author

After updating to the latest version of the pages-gem (v229), the Docker image was updated to Ruby 3 and fails because of issue #752. To work around this you now also need to run bundle add webrick before jekyll serve:

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

@pmarinova
Copy link
Author

I tested the fix and the 'github-pages' gem not found error disappears, but the site is not generated properly. Everything is just plain text. It's the same behavior as when there is no Gemfile at the site root.

Anyway, this is not an issue for me anymore as I realized this docker image is intended for development of the github-pages gem whereas my case is to simply run a github-pages site locally. I am now using the latest version of the github-pages gem from rubygems like this: https://gist.github.com/pmarinova/0b345a2656abe079c322ad0a90a32c61

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 a pull request may close this issue.

1 participant