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 my404.html
,_config.yml
andindex.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.)
- Clone the repo, switch to the publishing source branch (usually
gh-pages
) - 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
- 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"
- Add
.gitignore
:
_site
.sass-cache
.jekyll-metadata
Gemfile.lock
- Build the image:
podman build --tag gh-pages .
- Run the image:
podman run -it --rm --volume="$PWD:/srv/jekyll:Z" -w /srv/jekyll -p 4000:4000 gh-pages /bin/sh
- Within the container, run
bundle exec jekyll serve --livereload --host 0.0.0.0
- Apply your changes
- Profit
Question
If I commit and push the Gemfile
, will this have an effect on the deployment?