Local testing of existing GitHub Jekyll site

Thanks for the info. Actually, I initially tried docker-based installs but ran in to version-based troubles. Probably because I didn’t know about pages.github.com/versions.

Very professional video, btw! You’re a great narrator.

A few details I noticed:

  • Some of the commands in your repo contain instead of ". Might confuse some younglings.

  • The command bundle exec jekyll new --force --skip-bundle . overrides my 404.html, _config.yml and index.md, so it is not suitable to test existing gh-pages!

My solution to locally run existing gh-pages:

(If you use docker, simply replace podman with docker in all commands below.)

  1. Clone the repo, switch to the publishing source branch (usually gh-pages)
  2. Add a Dockerfile with this content:
# Create a github-pages container from a Ruby Alpine image
# Choose the ruby version according to https://pages.github.com/versions/
FROM ruby:2.7-alpine3.15

# Add Jekyll dependencies to Alpine
RUN apk update
RUN apk add --no-cache build-base gcc cmake git

# Install github-pages
RUN gem update bundler && gem install bundler webrick github-pages
  1. Add a Gemfile with this content:
source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

gem 'github-pages', group: :jekyll_plugins

gem "webrick"
  1. Add .gitignore:
_site
.sass-cache
.jekyll-metadata
Gemfile.lock
  1. Build the image: podman build --tag gh-pages .
  2. Run the image: podman run -it --rm --volume="$PWD:/srv/jekyll:Z" -w /srv/jekyll -p 4000:4000 gh-pages /bin/sh
  3. Within the container, run bundle exec jekyll serve --livereload --host 0.0.0.0
  4. Apply your changes
  5. Profit

Question

If I commit and push the Gemfile, will this have an effect on the deployment?